button BTN = new button();//初始化控件
btn.size =新大小(100,100);//設置大小
btn.location =新位置(50,100);//設置坐標
BTN . text = " Button 1 ";//設置文本
this . controls . add(BTN);//添加到表單中
大概就是這樣。