private int i=0;
private void button1_Click(object sender, EventArgs e)
{
PictureBox myPic = new PictureBox();
myPic.Name = "pic" + i;
this.Controls.Add(myPic);
}
在创建了N个PictureBox之后,我想获取第i=5的PictureBox的Name属性,怎么解决?
private void button1_Click(object sender, EventArgs e)
{
PictureBox myPic = new PictureBox();
myPic.Name = "pic" + i;
this.Controls.Add(myPic);
}
在创建了N个PictureBox之后,我想获取第i=5的PictureBox的Name属性,怎么解决?
CheckBox[] name = new CheckBox[num];
for (int i = 0; i < num; i++)
{
name[i] = new CheckBox();
name[i].Text = fileName[i];
name[i].Location = new Point(20, 10 + i * 25);
name[i].Size = new Size(104, 16);
name[i].Checked = false;
pointStyleDlg.panel2.Controls.Add(name[i]);
}获取: foreach (Control c in this.splitContainer2.Panel1.Controls)
{
if (c is CheckBox)//此处修改控件名称
{
if (((CheckBox)c).Checked)
{
fileds.Add(((CheckBox)c).Text.ToString());
}
}
}
我中批号运行之后获取,比如说在
private void button2_Click(object sender, EventArgs e)
{
//获取Name
}
private void button2_Click(object sender, EventArgs e)
{
//获取第i=5的PictureBox的Name属性
}
不知所云~IPO是 Input -> Proess -> Output没Input处理个屁啊!!
MessageBox.Show(ctrl.Name)