ComponentFactory.Krypton.Toolkit.RenderStandard.DrawRibbonGroupSeparator C# (CSharp) Method

DrawRibbonGroupSeparator() public method

Perform drawing of a ribbon group separator.
public DrawRibbonGroupSeparator ( PaletteRibbonShape shape, RenderContext context, Rectangle displayRect, IPaletteRibbonGeneral paletteGeneral, PaletteState state ) : void
shape PaletteRibbonShape Ribbon shape.
context RenderContext Render context.
displayRect System.Drawing.Rectangle Display area available for drawing.
paletteGeneral IPaletteRibbonGeneral General ribbon palette details.
state PaletteState State associated with rendering.
return void
        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;
            }
        }
RenderStandard