using System.Drawing.Drawing2D;
private void Form1_SizeChanged(object sender, EventArgs e)
{
Region region = null;
switch (this.WindowState)
{
case FormWindowState.Maximized:
region = new Region(this.ClientRectangle);
break;
case FormWindowState.Normal:
using (GraphicsPath path = new GraphicsPath())
{
int r = 16;
path.AddArc(0, 0, r, r, 180, 90);
path.AddArc(this.Width - r - 1, 0, r, r, 270, 90);
path.AddArc(this.Width - r - 1, this.Height - r - 1, r, r, 0, 90);
path.AddArc(0, this.Height - r - 1, r, r, 90, 90);
region = new Region(path);
}
break;
default:
return;
}
this.Region = region;
}