winform如何在Form1中动态添加多个Label控件

就是写个for循环..想添加几个Label就添加几个!求代码..不解释!
2024-11-03 16:42:22
推荐回答(1个)
回答1:

for (int i = 0; i < 10; i++)
{
Label lbl = new Label();
lbl.Location = new Point(20, 20 * i);
lbl.Text = i.ToString();
this.Controls.Add(lbl);
}