Baka_MPlayer.Controls.ColorSlider.CreateRoundRectPath C# (CSharp) Method

CreateRoundRectPath() public static method

Creates the round rect path.
public static CreateRoundRectPath ( Rectangle rect, Size size ) : GraphicsPath
rect System.Drawing.Rectangle The rectangle on which graphics path will be spanned.
size System.Drawing.Size The size of rounded rectangle edges.
return System.Drawing.Drawing2D.GraphicsPath
        public static GraphicsPath CreateRoundRectPath(Rectangle rect, Size size)
        {
            var gp = new GraphicsPath();
            gp.AddLine(rect.Left + size.Width / 2, rect.Top, rect.Right - size.Width / 2, rect.Top);
            gp.AddArc(rect.Right - size.Width, rect.Top, size.Width, size.Height, 270, 90);

            gp.AddLine(rect.Right, rect.Top + size.Height / 2, rect.Right, rect.Bottom - size.Width / 2);
            gp.AddArc(rect.Right - size.Width, rect.Bottom - size.Height, size.Width, size.Height, 0, 90);

            gp.AddLine(rect.Right - size.Width / 2, rect.Bottom, rect.Left + size.Width / 2, rect.Bottom);
            gp.AddArc(rect.Left, rect.Bottom - size.Height, size.Width, size.Height, 90, 90);

            gp.AddLine(rect.Left, rect.Bottom - size.Height / 2, rect.Left, rect.Top + size.Height / 2);
            gp.AddArc(rect.Left, rect.Top, size.Width, size.Height, 180, 90);
            return gp;
        }