/// 在類別內加入一個data member,並馬上new物件,呼叫建構子。
partial class Form1 : Form
{
private Button button1 = new Button();
///建構子中設定物件屬性
public Form1()
{
button1.Location = new Point(10, 10);
button1.TabIndex = 0;
button1.Text = "Navigate Qos";
button1.AutoSize = true;
button1.Click += new EventHandler(button1_Click);
///最後加入Control中
this.Controls.Add(button1);
沒有留言:
張貼留言