日期:2014-05-17  浏览次数:20707 次

批量添加控件只能添加第一个
我想批量添加lable到指定容器里,比如:

Label lbl1 = new Label();
lbl1.Name = "lable11";
lbl1.Text = "lable11";
lbl1.Location = new Point(53, 154);
this.gbList.Controls.Add(lbl1);

Label lbl2 = new Label();
lbl2.Name = "lable22";
lbl2.Text = "lable22";
lbl2.Location = new Point(101,154);
this.gbList.Controls.Add(lbl2);

上面两断代码一个一个运行都可以添加成功,一起运行就只有lable11,而没有lable22
这是不是个太弱智的问题
添加控件

------解决方案--------------------
this.gbList  是什么容器?
------解决方案--------------------
......这....前面那个把后面那个覆盖了啊 亲~~~~~~
lbl1.Width = 50;
------解决方案--------------------
给定两个lable的宽度和高度