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

AddRoundedPath() private static method

private static AddRoundedPath ( GraphicsPath borderPath, VisualOrientation orientation, Rectangle rect, bool forBorder ) : void
borderPath System.Drawing.Drawing2D.GraphicsPath
orientation VisualOrientation
rect System.Drawing.Rectangle
forBorder bool
return void
        private static void AddRoundedPath(GraphicsPath borderPath,
                                           VisualOrientation orientation,
                                           Rectangle rect, 
                                           bool forBorder)
        {
            // Cache the distance to make the corner rounded
            int x = _spacingTabRoundedCorner;

            switch (orientation)
            {
                case VisualOrientation.Top:
                    if (!forBorder)
                        borderPath.AddLine(rect.Right, rect.Bottom, rect.Left, rect.Bottom);

                    borderPath.AddLine(rect.Left, rect.Bottom, rect.Left, rect.Top + x);
                    borderPath.AddLine(rect.Left, rect.Top + x, rect.Left + x, rect.Top);
                    borderPath.AddLine(rect.Left + x, rect.Top, rect.Right - x, rect.Top);
                    borderPath.AddLine(rect.Right - x, rect.Top, rect.Right, rect.Top + x);
                    borderPath.AddLine(rect.Right, rect.Top + x, rect.Right, rect.Bottom);
                    break;
                case VisualOrientation.Bottom:
                    if (!forBorder)
                        borderPath.AddLine(rect.Right, rect.Top, rect.Left, rect.Top);

                    borderPath.AddLine(rect.Left, rect.Top, rect.Left, rect.Bottom - x);
                    borderPath.AddLine(rect.Left, rect.Bottom - x, rect.Left + x, rect.Bottom);
                    borderPath.AddLine(rect.Left + x, rect.Bottom, rect.Right - x, rect.Bottom);
                    borderPath.AddLine(rect.Right - x, rect.Bottom, rect.Right, rect.Bottom - x);
                    borderPath.AddLine(rect.Right, rect.Bottom - x, rect.Right, rect.Top);
                    break;
                case VisualOrientation.Left:
                    if (!forBorder)
                        borderPath.AddLine(rect.Right, rect.Top, rect.Right, rect.Bottom);

                    borderPath.AddLine(rect.Right, rect.Bottom, rect.Left + x, rect.Bottom);
                    borderPath.AddLine(rect.Left + x, rect.Bottom, rect.Left, rect.Bottom - x);
                    borderPath.AddLine(rect.Left, rect.Bottom - x, rect.Left, rect.Top + x);
                    borderPath.AddLine(rect.Left, rect.Top + x, rect.Left + x, rect.Top);
                    borderPath.AddLine(rect.Left + x, rect.Top, rect.Right, rect.Top);
                    break;
                case VisualOrientation.Right:
                    if (!forBorder)
                        borderPath.AddLine(rect.Left, rect.Top, rect.Left, rect.Bottom);

                    borderPath.AddLine(rect.Left, rect.Bottom, rect.Right - x, rect.Bottom);
                    borderPath.AddLine(rect.Right - x, rect.Bottom, rect.Right, rect.Bottom - x);
                    borderPath.AddLine(rect.Right, rect.Bottom - x, rect.Right, rect.Top + x);
                    borderPath.AddLine(rect.Right, rect.Top + x, rect.Right - x, rect.Top);
                    borderPath.AddLine(rect.Right - x, rect.Top, rect.Left, rect.Top);
                    break;
            }
        }
RenderStandard