public void painLabel()
{
Label[] lbl = new Label[5];
for (int i = 0; i < 5; i++)
{
lbl[i]=new Label();
lbl[i].Name = "lbl" + i.ToString();
lbl[i].Text = "lbl" + i.ToString();
this.Controls.Add(lbl[i]);
lbl[i].Location = new Point(i,i*50);
}
}
这样也可以的 数组
{
Label[] lbl = new Label[5];
for (int i = 0; i < 5; i++)
{
lbl[i]=new Label();
lbl[i].Name = "lbl" + i.ToString();
lbl[i].Text = "lbl" + i.ToString();
this.Controls.Add(lbl[i]);
lbl[i].Location = new Point(i,i*50);
}
}
这样也可以的 数组