如何創建非矩形的Windows窗體?

在窗體的Paint事件中設定。注意不僅可以讓窗體非矩形顯示,也可以讓所有的控件非矩形顯示,因爲都有Paint事件

 private void Form1_Paint(object sender, PaintEventArgs e)
        
{
            System.Drawing.Drawing2D.GraphicsPath shape 
= new System.Drawing.Drawing2D.GraphicsPath();
            shape.AddEllipse(
00this.Width, this.Height);
            
this.Region = new System.Drawing.Region(shape);
        }

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章