社区
C#
帖子详情
请问C#里怎么把radioBox分组?
lagger
2004-05-02 08:33:50
比如我有四个radioBox,想把1,2分成一组,3,4分成一组隶属于前面的第一组,怎么分?
...全文
674
5
打赏
收藏
请问C#里怎么把radioBox分组?
比如我有四个radioBox,想把1,2分成一组,3,4分成一组隶属于前面的第一组,怎么分?
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
5 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
lagger
2004-05-02
打赏
举报
回复
.....
如果我有一百个就用一百个if了?
dark012002
2004-05-02
打赏
举报
回复
if(this.radiobutton5.checked)
{
// do something..
}
if( !this.radioButton6.checked)
{
// do anything...
}
lagger
2004-05-02
打赏
举报
回复
哈哈,原来可以把控件拖进去的,只是差怎么知道哪个radionbutton给选择的判断了.
lagger
2004-05-02
打赏
举报
回复
谢谢,不过看得很晕,只能在代码里改,不能在设计器里面改吗?还有,我在处理里,怎么知道哪个radiobutton选择了,哪个没有选择?
youngby
2004-05-02
打赏
举报
回复
private void InitializeComponent()
{
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.radioButton1 = new System.Windows.Forms.RadioButton();
this.radioButton2 = new System.Windows.Forms.RadioButton();
this.panel1 = new System.Windows.Forms.Panel();
this.radioButton3 = new System.Windows.Forms.RadioButton();
this.radioButton4 = new System.Windows.Forms.RadioButton();
this.groupBox1.SuspendLayout();
this.panel1.SuspendLayout();
this.SuspendLayout();
//
// groupBox1
//
this.groupBox1.Controls.Add(this.radioButton2);
this.groupBox1.Controls.Add(this.radioButton1);
this.groupBox1.Location = new System.Drawing.Point(32, 32);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(240, 184);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "groupBox1";
//
// radioButton1
//
this.radioButton1.Location = new System.Drawing.Point(48, 32);
this.radioButton1.Name = "radioButton1";
this.radioButton1.TabIndex = 0;
this.radioButton1.Text = "radioButton1";
//
// radioButton2
//
this.radioButton2.Location = new System.Drawing.Point(56, 144);
this.radioButton2.Name = "radioButton2";
this.radioButton2.TabIndex = 1;
this.radioButton2.Text = "radioButton2";
//
// panel1
//
this.panel1.Controls.Add(this.radioButton4);
this.panel1.Controls.Add(this.radioButton3);
this.panel1.Location = new System.Drawing.Point(48, 256);
this.panel1.Name = "panel1";
this.panel1.TabIndex = 1;
//
// radioButton3
//
this.radioButton3.Location = new System.Drawing.Point(32, 16);
this.radioButton3.Name = "radioButton3";
this.radioButton3.TabIndex = 2;
this.radioButton3.Text = "radioButton3";
//
// radioButton4
//
this.radioButton4.Location = new System.Drawing.Point(32, 64);
this.radioButton4.Name = "radioButton4";
this.radioButton4.TabIndex = 3;
this.radioButton4.Text = "radioButton4";
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(292, 373);
this.Controls.Add(this.panel1);
this.Controls.Add(this.groupBox1);
this.Name = "Form1";
this.Text = "Form1";
this.groupBox1.ResumeLayout(false);
this.panel1.ResumeLayout(false);
this.ResumeLayout(false);
}
如何对
radio
box
按钮
分组
并且互斥
多组和一组是一样的使用,只要搞清楚哪个是哪一组的就行了。很简单,先为这些
Radio
Button排个顺序,就是排列他们的TAB ORDER。在对话框资源面板上Ctrl+D,然后按你自己的理想顺序用鼠标逐个点击就可以了。不妨假设
Radio
1、
Radio
2、
Radio
3、
Radio
4分别是1、2、3、4。
Radio
1和
Radio
3都选上Group属性,那么,1、2是一组,3、4是另外一组,因为
分组
的原
单选框的
分组
#-*- coding: UTF-8 -*- import wx class
Radio
Box
Frame(wx.Frame): def __init__(self): wx.Frame.__init__(self,None,-1,u"单选框",size=(320,150)) panel=wx.Panel(self,-1) colorList
radio
button的
分组
1. 环境:VS2010 2.
分组
将
radio
1、
radio
2、
radio
3分为1组,
radio
4、
radio
5分为另一组; 方法:设置
radio
1 的 属性: group、tabstop、auto均为true 设置
radio
2 的 属性: group设为false, tabstop、auto均为true 设置
radio
3 的 属性:group设为fal
winform开发中
Radio
Button
分组
设定
在工作中遇到了这样一个问题,就是在同一界面下放了多个
Radio
Button,运行点击以后发现只能选择一个,想把
Radio
Button分成多个组,在网上查了好多资料说是要将同一组下的
Radio
Button放到同一个容器中,容器可以为Panel或Group
Box
,在实际应用中我发现无法将
Radio
Button拖到同一个容器中。 经过我个人的实验,发现只要将所有的
Radio
Button的AutoChe...
Winform 动态添加
Radio
Button、Check
Box
且任意
分组
Winform 动态添加
Radio
Button、Check
Box
且任意
分组
C#
110,534
社区成员
642,575
社区内容
发帖
与我相关
我的任务
C#
.NET技术 C#
复制链接
扫一扫
分享
社区描述
.NET技术 C#
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
让您成为最强悍的C#开发者
试试用AI创作助手写篇文章吧
+ 用AI写文章