代码如下:
private void button1_Click(object sender, EventArgs e)
{
TextBox textbox = new TextBox();
if (list.Count == 0)
{
textbox.Location = new Point(20, 20);
this.Controls.Add(textbox);
this.ResumeLayout(false);
list.Add(textbox);
}
else
{
TextBox a = list.Last<TextBox>();
int b = a.Location.Y;
b += 20;
textbox.Location = new Point(20, b);
this.Controls.Add(textbox);
this.ResumeLayout(false);
list.Add(textbox);
}
}