动态创建的 CheckBox 中没有文本
No text in dynamically created CheckBox
正如您在标题中看到的,我正在使用以下代码创建动态复选框:
private void create_checks(int nr, string name)
{
checkBox[nr] = new CheckBox();
checkBox[nr].Size = new Size(20, 43);
checkBox[nr].Name = name;
checkBox[nr].Text = name;
checkBox[nr].Location = new Point(40, 20 + (nr * 20));
this.Controls.Add(checkBox[nr]);
}
但是复选框没有文字,有人可以帮我吗?
增加:
checkBox[nr] = new CheckBox();
checkBox[nr].Size = new Size(120, 43);
checkBox[nr].Name = name;
checkBox[nr].Text = name;
checkBox[nr].Location = new Point(40, 20 + (nr * 20));
frm.Controls.Add(checkBox[nr]);
正如您在标题中看到的,我正在使用以下代码创建动态复选框:
private void create_checks(int nr, string name)
{
checkBox[nr] = new CheckBox();
checkBox[nr].Size = new Size(20, 43);
checkBox[nr].Name = name;
checkBox[nr].Text = name;
checkBox[nr].Location = new Point(40, 20 + (nr * 20));
this.Controls.Add(checkBox[nr]);
}
但是复选框没有文字,有人可以帮我吗?
增加:
checkBox[nr] = new CheckBox();
checkBox[nr].Size = new Size(120, 43);
checkBox[nr].Name = name;
checkBox[nr].Text = name;
checkBox[nr].Location = new Point(40, 20 + (nr * 20));
frm.Controls.Add(checkBox[nr]);