當前位置:名人名言大全網 - 端午節短信 - 如何在C# WinForm中動態添加控件和設計控件的布局

如何在C# WinForm中動態添加控件和設計控件的布局

喜歡按鈕

button BTN = new button();//初始化控件

btn.size =新大小(100,100);//設置大小

btn.location =新位置(50,100);//設置坐標

BTN . text = " Button 1 ";//設置文本

this . controls . add(BTN);//添加到表單中

大概就是這樣。