不知道代码哪里出现问题,,要求点击一下button1在panel上就出现一个button
,要求点击一下button1在panel上就出现一个button,可是效果始终只有一个button 如下代码:
private void button1_Click(object sender, EventArgs e)
{
int x = 0, y = 0, i = 1;
Button b = new Button();
b.Location = new System.Drawing.Point(24 + x, 33 + y);
b.Name = "button";
b.Size = new System.Drawing.Size(71, 26);
// b.TabIndex = 0;
b.Text = "button" + i;
b.UseVisualStyleBackColor = true;
//b.Click += new System.EventHandler(this.button1_Click);
panel1.Controls.Add(b);
x = x + 5;
y = y + 4;
i++;
}