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

DrawRibbonTabGlowingTop() protected method

Internal rendering method.
protected DrawRibbonTabGlowingTop ( Rectangle rect, Color c1, Color c2, Color insideColor, MementoRibbonTabGlowing cache ) : void
rect System.Drawing.Rectangle
c1 Color
c2 Color
insideColor Color
cache MementoRibbonTabGlowing
return void
        protected virtual void DrawRibbonTabGlowingTop(Rectangle rect, 
                                                       Color c1, Color c2, Color insideColor, 
                                                       MementoRibbonTabGlowing cache)
        {
            GraphicsPath outsidePath = new GraphicsPath();
            GraphicsPath topPath = new GraphicsPath();
            GraphicsPath ellipsePath = new GraphicsPath();

            // Create path for a curved border around the tab
            outsidePath.AddLine(rect.Left, rect.Bottom - 2, rect.Left, rect.Top + 1.5f);
            outsidePath.AddLine(rect.Left, rect.Top + 1.5f, rect.Left + 2, rect.Top);
            outsidePath.AddLine(rect.Left + 2, rect.Top, rect.Right - 4, rect.Top);
            outsidePath.AddLine(rect.Right - 4, rect.Top, rect.Right - 2, rect.Top + 1.5f);
            outsidePath.AddLine(rect.Right - 2, rect.Top + 1.5f, rect.Right - 2, rect.Bottom - 2);

            // Create path for the top glassy effect
            int q4 = rect.Height / 4;
            topPath.AddLine(rect.Left + 2, rect.Top + 1, rect.Left + 1, rect.Top + 2);
            topPath.AddLine(rect.Left + 1, rect.Top + 2, rect.Left + 1, rect.Top + 2 + q4);
            topPath.AddLine(rect.Left + 1, rect.Top + 2 + q4, rect.Left + 4, rect.Top + 5 + q4);
            topPath.AddLine(rect.Left + 4, rect.Top + 5 + q4, rect.Right - 5, rect.Top + 5 + q4);
            topPath.AddLine(rect.Right - 5, rect.Top + 5 + q4, rect.Right - 2, rect.Top + 2 + q4);
            topPath.AddLine(rect.Right - 2, rect.Top + 2 + q4, rect.Right - 2, rect.Top + 2);
            topPath.AddLine(rect.Right - 2, rect.Top + 2, rect.Right - 3, rect.Top + 1);

            RectangleF topRectF = new RectangleF(rect.Left, rect.Top, rect.Width, q4 + 5);
            cache.topBrush = new LinearGradientBrush(topRectF, c1, Color.Transparent, 90f);

            int ellipseWidth = (int)(rect.Width * 1.2f);
            int ellipseHeight = (int)(rect.Height * 0.4f);
            cache.fullRect = new RectangleF(rect.Left + 1, rect.Top + 1, rect.Width - 3, rect.Height - 2);
            cache.ellipseRect = new RectangleF(rect.Left - ((ellipseWidth - rect.Width) / 2), rect.Bottom - ellipseHeight, ellipseWidth, ellipseHeight * 2);

            // Cannot draw a path that contains a zero sized element
            if ((cache.ellipseRect.Width > 0) && (cache.ellipseRect.Height > 0))
            {
                ellipsePath.AddEllipse(cache.ellipseRect);
                cache.ellipseBrush = new PathGradientBrush(ellipsePath);
                cache.ellipseBrush.CenterColor = c2;
                PointF centerPoint = new PointF(cache.ellipseRect.Left + (cache.ellipseRect.Width / 2), cache.ellipseRect.Top + (cache.ellipseRect.Height / 2));
                cache.ellipseBrush.CenterPoint = centerPoint;
                cache.ellipseBrush.SurroundColors = new Color[] { Color.Transparent };
            }

            cache.insideBrush = new SolidBrush(insideColor);
            cache.insidePen = new Pen(insideColor);
            cache.outsidePen = new Pen(c1);
            cache.outsidePath = outsidePath;
            cache.topPath = topPath;
            cache.ellipsePath = ellipsePath;
        }
RenderStandard