RadioButton[] arrayCheck = new RadioButton[xi + 1]
是不是应该改用RadioButtonList ?
而且你每次循环都生成一个RadioButton[] ,却都只添加一个RadioButton
是不是应该把RadioButton[]当成公用的,而不是每次循环时生成呢? (其实我感觉你这里的 arrayCheck完全没有意义)
还有你是怎么把RadioButton添加到页面上的呢?这段代码你没有贴上来
下面是我改的一个例子,你试试吧,只改了Page_Load:
p
rotected void Page_Load(object sender, EventArgs e)//页面load{
for (int xi = 1 xi <= j xi++)//构造单选框
{
RadioButton temcheck = new RadioButton()
temcheck.GroupName = "A"
temcheck.ID = xi.ToString()
temcheck.CheckedChanged += new EventHandler(_testpaper_CheckedChanged)
this.form1.Controls.Add(temcheck)
}
}
直接添加就可以了,放个tpanel,之后在panel选中的情况下,直接往里面放RadioButton就可以了。
排版RadioGroup的RadioButton
1)实际上只要明白在radiogroup里面也可以使用RelativeLayout,LinearLayout这样的布局的;首先设置radiogroup的orientation属性为vertical;
2)然后再第一个radiobutton前面加上LinearLayout,orientation属性设置为horizontal,</LinearLayout>标签放在一行最后一个radiobutton后面;
3)同样的把使用LinearLayout把后面几个radiobutton包裹住,orientation属性设置为horizontal;
4)运行一下就可以发现就达到了想要的结果了。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)