发布网友 发布时间:2022-04-22 04:25
共2个回答
热心网友 时间:2022-04-15 01:52
单击button1在panel上动态新建了多个label,现在想要点击选择某个动态新建的label,按button2,可以把这个label删掉
在button1_Click事件中,创建label,代码:
Label lb1 = new Label();
lb1.Name = "panel"+j;
lb1.BackColor = Color.Transparent;
lb1.BorderStyle = BorderStyle.FixedSingle;
Panel1.Controls.Add(lb1);
为这些label增加Click事件
Label lb1 = new Label();
lb1.Name = "panel"+j;
lb1.BackColor = Color.Transparent;
热心网友 时间:2022-04-15 03:10
Form from1 = new Form();
TextBox txt = new TextBox();
txt.Width = 200;
txt.Position = new Point(100, 100);
from1.AddControl(txt);
from1.Show();