//写个例子给你,你自己看一下
int top = 10;
int left = 10;
for (int i = 1; i < 10; i++)
{
Label lblTitle = new Label();
lblTitle.Name = "lblTitle" + i.ToString();
lblTitle.Text = lblTitle.Name;
lblTitle.Left = left;
lblTitle.Top =i*(top+lblTitle.Height);
pnl.Controls.Add(lblTitle);
}
//写个例子给你,你自己看一下
int
top
=
10;
int
left
=
10;
for
(int
i
=
1;
i
<
10;
i++)
{
Label
lblTitle
=
new
Label();
lblTitle.Name
=
"lblTitle"
+
i.ToString();
lblTitle.Text
=
lblTitle.Name;
lblTitle.Left
=
left;
lblTitle.Top
=i*(top+lblTitle.Height);
pnl.Controls.Add(lblTitle);
}
你添加的时候,要设定动态设定他的位置的啊inkbabel.Location= new point(x,y),xy是你计算出来的位置值
linkbabel.Location = new System.Drawing.Point(33,44);
33、44为LinkLabel相对于panel容器的坐标。
没有指定location