public void Setwindowregion ()
{
System.Drawing.Drawing2D.GraphicsPath Formpath;
Formpath = new System.Drawing.Drawing2D.GraphicsPath ();
Rectangle rect = new Rectangle (0, this. Width, this. HEIGHT-22);//this. Left-10,this. Top-10,this. Width-10,this. HEIGHT-10);
Formpath = Getroundedrectpath (rect, 30);
This. Region = new Region (Formpath);
}
Private GraphicsPath Getroundedrectpath (Rectangle rect, int radius)
{
int diameter = RADIUS;
Rectangle arcrect = new Rectangle (rect. Location, new Size (diameter, diameter));
GraphicsPath path = new GraphicsPath ();
Upper left corner
Path. AddArc (Arcrect, 180, 90);
upper right corner
Arcrect.x = rect. Right-diameter;
Path. AddArc (Arcrect, 270, 90);
Lower right corner
Arcrect.y = rect. Bottom-diameter;
Path. AddArc (arcrect, 0, 90);
Lower left corner
Arcrect.x = rect. Left;
Path. AddArc (Arcrect, 90, 90);
Path. Closefigure ();
return path;
}
protected override void OnResize (System.EventArgs e)
{
This. region = NULL;
Setwindowregion ();
}
WinForm form into rounded corners