在.net window form编程中,窗体都以矩形方式展现给用户,我们可以将窗体个性化,创建非矩形的Windows窗体。
private
void
Form1_Paint(
object
sender, PaintEventArgs e)
... {
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);
}
... {
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);
}