/// <summary>
 /// Gets the color for the dialog launcher dark.
 /// </summary>
 /// <param name="state">Palette value should be applicable to this state.</param>
 /// <returns>Color value.</returns>
 public Color GetRibbonGroupSeparatorDark(PaletteState state)
 {
     if (GroupSeparatorDark != Color.Empty)
     {
         return(GroupSeparatorDark);
     }
     else
     {
         return(_inherit.GetRibbonGroupSeparatorDark(state));
     }
 }
        /// <summary>
        /// Gets the color for the group separator dark.
        /// </summary>
        /// <param name="state">Palette value should be applicable to this state.</param>
        /// <returns>Color value.</returns>
        public override Color GetRibbonGroupSeparatorDark(PaletteState state)
        {
            IPaletteRibbonGeneral inherit = GetInherit(state);

            if (inherit != null)
            {
                return(inherit.GetRibbonGroupSeparatorDark(state));
            }
            else
            {
                return(Target.GetRibbonGroupSeparatorDark(state));
            }
        }
Example #3
0
        /// <summary>
        /// Gets the color for the group separator dark.
        /// </summary>
        /// <param name="state">Palette value should be applicable to this state.</param>
        /// <returns>Color value.</returns>
        public override Color GetRibbonGroupSeparatorDark(PaletteState state)
        {
            IPaletteRibbonGeneral inherit = GetInherit(state);

            return(inherit?.GetRibbonGroupSeparatorDark(state) ?? Target.GetRibbonGroupSeparatorDark(state));
        }
Example #4
0
        /// <summary>
        /// Perform drawing of a ribbon group separator.
        /// </summary>
        /// <param name="shape">Ribbon shape.</param>
        /// <param name="context">Render context.</param>
        /// <param name="displayRect">Display area available for drawing.</param>
        /// <param name="paletteGeneral">General ribbon palette details.</param>
        /// <param name="state">State associated with rendering.</param>
        public override void DrawRibbonGroupSeparator(PaletteRibbonShape shape,
                                                      RenderContext context,
                                                      Rectangle displayRect,
                                                      IPaletteRibbonGeneral paletteGeneral,
                                                      PaletteState state)
        {
            Debug.Assert(context != null);
            Debug.Assert(paletteGeneral != null);

            // Validate parameter references
            if (context == null) throw new ArgumentNullException("context");
            if (paletteGeneral == null) throw new ArgumentNullException("paletteGeneral");

            int x = displayRect.X + (displayRect.Width - 2) / 2;
            Color darkColor = paletteGeneral.GetRibbonGroupSeparatorDark(state);
            Color lightColor = paletteGeneral.GetRibbonGroupSeparatorLight(state);

            switch (shape)
            {
                default:
                case PaletteRibbonShape.Office2007:
                    using (Pen darkPen = new Pen(darkColor),
                               lightPen = new Pen(lightColor))
                    {
                        context.Graphics.DrawLine(lightPen, x, displayRect.Top + 2, x, displayRect.Bottom - 3);
                        context.Graphics.DrawLine(darkPen, x + 1, displayRect.Top + 2, x + 1, displayRect.Bottom - 3);
                    }
                    break;
                case PaletteRibbonShape.Office2010:
                    using (LinearGradientBrush darkBrush = new LinearGradientBrush(new RectangleF(displayRect.X, displayRect.Y - 1, displayRect.Width, displayRect.Height + 2), Color.FromArgb(72, darkColor), darkColor, 90f),
                                               lightBrush = new LinearGradientBrush(new RectangleF(displayRect.X - 1, displayRect.Y - 1, displayRect.Width + 2, displayRect.Height + 2), Color.FromArgb(128, lightColor), lightColor, 90f))
                    {
                        darkBrush.SetSigmaBellShape(0.5f);
                        lightBrush.SetSigmaBellShape(0.5f);

                        using (Pen darkPen = new Pen(darkBrush))
                        {
                            context.Graphics.FillRectangle(lightBrush, x, displayRect.Top, 3, displayRect.Height);
                            context.Graphics.DrawLine(darkPen, x + 1, displayRect.Top, x + 1, displayRect.Bottom - 1);
                        }
                    }
                    break;
            }
        }