How to make a Non Rectangular Winforms ?

Posted by karthik on Stack Overflow See other posts from Stack Overflow or by karthik
Published on 2010-04-19T01:31:09Z Indexed on 2010/04/19 1:33 UTC
Read the original article Hit count: 273

Filed under:

I am using the below code to change to shape of the winform. Its changing the shape, but not like how i wanted. I need the forms to have curved corners.

What points should i use to get it ?

    public void MakeNonRectangularForm()
    {
        System.Drawing.Drawing2D.GraphicsPath p = new System.Drawing.Drawing2D.GraphicsPath();
        int width = this.ClientSize.Width;
        int height = this.ClientSize.Height;
        p.AddClosedCurve(new Point[]{new Point(width/2, height/2), 
          new Point(width,0), new Point(width, height/3),
          new Point(width-width/3, height),
          new Point(width/7, height-height/8)});
        this.Region = new Region(p);
    }

© Stack Overflow or respective owner

Related posts about c#