我們看到的WinForm總是方形的

但可以改成圓形或是多邊形

(在設計畫面看不到,一定要動態更改)

System.Drawing.Drawing2D.GraphicsPath myPath =
new System.Drawing.Drawing2D.GraphicsPath();

//圓形
myPath.AddEllipse(0, 0, this.Width, this.Height);

Region myRegion = new Region(myPath);

this.Region = myRegion;

也可以用多邊形如下

myPath.AddPolygon(new Point[] { new Point(0, 0), new Point(0, this.Height),
new Point(this.Width, 0) });

arrow
arrow
    全站熱搜

    welkingunther 發表在 痞客邦 留言(0) 人氣()