Creating a different types of Shaped Form in C#

 
The following examples show how we can draw or create different types of shaped form ( such as in the form of ellipse, pie,rectangle etc) in C# with the help of OnPaint method of the form.

If you want to create a form in elliptical shape, you can copy the method declaration as well as the drawing code inside the method:

private void Form1_Paint(object sender, PaintEventArgs e)
   {
      System.Drawing.Drawing2D.GraphicsPath frmShape = new System.Drawing.Drawing2D.GraphicsPath();
     frmShape.AddEllipse(0, 0, this.Width, this.Height);
     this.Region = new System.Drawing.Region(frmShape);
   }
An ellipse shaped form

If you want to create a form in pie shape:

private void Form1_Paint(object sender, PaintEventArgs e)
   {
     System.Drawing.Drawing2D.GraphicsPath frmShape = new System.Drawing.Drawing2D.GraphicsPath();
     frmShape.AddPie(0, 0, this.Width, this.Height,180,180);
     this.Region = new System.Drawing.Region(frmShape);
   }