积极答复者
单选框的问题

问题
答案
全部回复
-
谢谢您!
以下是截取部分代码:
int ChildHeight = 0;
for (int x = 0; x < BallsGroup.Length; x++)
{
if (BallsGroup[x] != null)
{
RadioButton rb = new RadioButton();
rb.Name = rb_name + (x + 1).ToString();
rb.Text = BallsGroup[x];
rb.Size = new Size(50, 20);
rb.Location = new Point(20, 20 + x * 20 + ChildHeight);
rb.CheckedChanged += new EventHandler(rb_CheckedChanged);
gb.Controls.Add(rb);
if (rbsender_name_right == (x + 1).ToString())//start add child groupbox
{
gb_child.Location = new Point(40, 20 + x * 20 + 20);
gb.Controls.Add(gb_child);//这里添加另外一个控件,gb_child该控件及其子控件均已生成。
ChildHeight = gb_child.Height;
}
}
}
Control[] cl = gb.Controls.Find(rbsender_name, false);
if (cl.Length > 0)
{
RadioButton temprb = (RadioButton) cl[0];
//temprb.Checked = true;
}