ComponentFactory.Krypton.Ribbon.ViewDrawRibbonTab.RenderBefore2010ContextTab C# (CSharp) Method

RenderBefore2010ContextTab() private method

private RenderBefore2010ContextTab ( RenderContext context, ContextTabSet cts ) : void
context ComponentFactory.Krypton.Toolkit.RenderContext
cts ContextTabSet
return void
        private void RenderBefore2010ContextTab(RenderContext context, ContextTabSet cts)
        {
            // Grab the colors we draw the context separators and background in
            Color c1 = _paletteGeneral.GetRibbonTabSeparatorContextColor(PaletteState.Normal);
            Color c2 = cts.ContextColor;
            Color lightC2 = ControlPaint.Light(c2);
            Color c3 = CommonHelper.MergeColors(Color.Black, 0.1f, c2, 0.9f);

            Rectangle contextRect = new Rectangle(ClientRectangle.X - 1, ClientRectangle.Y - 1, ClientRectangle.Width + 2, ClientRectangle.Height + 1);
            Rectangle fillRect = new Rectangle(ClientRectangle.X - 2, ClientRectangle.Y - 1, ClientRectangle.Width + 4, ClientRectangle.Height);

            using (LinearGradientBrush outerBrush = new LinearGradientBrush(contextRect, c1, Color.Transparent, 90f),
                                       innerBrush = new LinearGradientBrush(contextRect, c3, Color.Transparent, 90f),
                                       fillBrush = new LinearGradientBrush(contextRect, Color.FromArgb(64, lightC2), Color.Transparent, 90f))
            {
                fillBrush.Blend = _contextBlend2010;

                using (Pen outerPen = new Pen(outerBrush),
                           innerPen = new Pen(innerBrush))
                {
                    if (cts.IsFirstTab(this))
                    {
                        // Draw left separators
                        context.Graphics.DrawLine(outerPen, contextRect.X, contextRect.Y, contextRect.X, contextRect.Bottom - 2);
                        context.Graphics.DrawLine(innerPen, contextRect.X + 1, contextRect.Y, contextRect.X + 1, contextRect.Bottom - 2);
                        fillRect.X += 2;
                        fillRect.Width -= 2;

                        if (cts.IsLastTab(this))
                        {
                            // Draw right separators
                            context.Graphics.DrawLine(outerPen, contextRect.Right - 1, contextRect.Y, contextRect.Right - 1, contextRect.Bottom - 2);
                            context.Graphics.DrawLine(innerPen, contextRect.Right - 2, contextRect.Y, contextRect.Right - 2, contextRect.Bottom - 2);
                            fillRect.Width -= 2;
                        }
                    }
                    else if (cts.IsLastTab(this))
                    {
                        // Draw right separators
                        context.Graphics.DrawLine(outerPen, contextRect.Right - 1, contextRect.Y, contextRect.Right - 1, contextRect.Bottom - 2);
                        context.Graphics.DrawLine(innerPen, contextRect.Right - 2, contextRect.Y, contextRect.Right - 2, contextRect.Bottom - 2);
                        fillRect.Width -= 2;
                    }

                    // Draw the background gradient
                    context.Graphics.FillRectangle(fillBrush, fillRect);
                }
            }
        }