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

DrawRibbonTabGlowingRight() protected method

Internal rendering method.
protected DrawRibbonTabGlowingRight ( 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 DrawRibbonTabGlowingRight(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 + 1, rect.Bottom - 1, rect.Right - 2.5f, rect.Bottom - 1);
            outsidePath.AddLine(rect.Right - 2.5f, rect.Bottom - 1, rect.Right - 1, rect.Bottom - 3);
            outsidePath.AddLine(rect.Right - 1, rect.Bottom - 3, rect.Right - 1, rect.Top + 3);
            outsidePath.AddLine(rect.Right - 1, rect.Top + 3, rect.Right - 2.5f, rect.Top + 1);
            outsidePath.AddLine(rect.Right - 2.5f, rect.Top + 1, rect.Left + 1, rect.Top + 1);

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

            RectangleF topRectF = new RectangleF(rect.Right - q4 - 5, rect.Top, q4 + 5, rect.Height);
            cache.topBrush = new LinearGradientBrush(topRectF, c1, Color.Transparent, 180f);

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

            // 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