我也刚学C#,我刚试的,能用:)
private void button2_Click(object sender, System.EventArgs e)
{
this.button3 = new System.Windows.Forms.Button();
this.button3.Anchor = (((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right);
this.button3.Location = new System.Drawing.Point(216, 230);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(56, 24);
this.button3.TabIndex = 6;
this.button3.Text = "button3";
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.button3,
});
}其实就是照Windows Form Designer generated code灰体字里的代码抄一边,然后调用this.Controls.AddRange(new System.Windows.Forms.Control[]{})添加到form里就可以了
其他的控件我想方法是一样的:)
private void button2_Click(object sender, System.EventArgs e)
{
this.button3 = new System.Windows.Forms.Button();
this.button3.Anchor = (((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right);
this.button3.Location = new System.Drawing.Point(216, 230);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(56, 24);
this.button3.TabIndex = 6;
this.button3.Text = "button3";
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.button3,
});
}其实就是照Windows Form Designer generated code灰体字里的代码抄一边,然后调用this.Controls.AddRange(new System.Windows.Forms.Control[]{})添加到form里就可以了
其他的控件我想方法是一样的:)
dy_2000_abc(芝麻开门) 大侠写的希望能给我提供帮助
我已经在里面做了回答。
接分。
小慧