在窗體的Paint事件中設定。注意不僅可以讓窗體非矩形顯示,也可以讓所有的控件非矩形顯示,因爲都有Paint事件
{
System.Drawing.Drawing2D.GraphicsPath shape = new System.Drawing.Drawing2D.GraphicsPath();
shape.AddEllipse(0, 0, this.Width, this.Height);
this.Region = new System.Drawing.Region(shape);
}