CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
可用分押宝游戏火热进行中... 专题改版:Java Web 专题
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  .NET技术 >  C#

请问C#里怎么把radioBox分组?

楼主lagger(懒人)2004-05-02 08:33:50 在 .NET技术 / C# 提问

比如我有四个radioBox,想把1,2分成一组,3,4分成一组隶属于前面的第一组,怎么分? 问题点数:20、回复次数:5Top

1 楼youngby(C-love)回复于 2004-05-02 08:46:57 得分 20

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);  
   
  }Top

2 楼lagger(懒人)回复于 2004-05-02 08:56:07 得分 0

谢谢,不过看得很晕,只能在代码里改,不能在设计器里面改吗?还有,我在处理里,怎么知道哪个radiobutton选择了,哪个没有选择?Top

3 楼lagger(懒人)回复于 2004-05-02 09:04:52 得分 0

哈哈,原来可以把控件拖进去的,只是差怎么知道哪个radionbutton给选择的判断了.Top

4 楼dark012002(Dark01)回复于 2004-05-02 09:10:14 得分 0

if(this.radiobutton5.checked)  
  {  
      //   do   something..  
  }  
   
  if(   !this.radioButton6.checked)  
  {    
        //   do   anything...  
  }Top

5 楼lagger(懒人)回复于 2004-05-02 09:30:09 得分 0

.....  
  如果我有一百个就用一百个if了?Top

相关问题

  • TDataSet组件建立分组索引,怎么建字段a为升,b为降,c再为升,不分大小写的索引呢
  • 这个怎么分组查询?
  • 怎么能取datawindow分组的行?
  • DataTable里怎么实现分组?
  • 在表格里怎么分组显示????
  • 还是分组语句,怎么写啊?!
  • TQRGroup怎么用?我怎么不能把报表分组显示?
  • c#怎么读?
  • c怎么学?
  • C#怎么念?

关键词

  • groupbox1
  • radiobutton
  • suspendlayout
  • panel
  • forms

得分解答快速导航

  • 帖主:lagger
  • youngby

相关链接

  • CSDN .NET频道
  • .NET类图书
  • C#类图书
  • .NET类源码下载

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
世纪乐知(北京)网络技术有限公司 版权所有, 京 ICP 证 020026 号
北京创新乐知广告有限公司 提供技术支持
Copyright © 2000-2007, CSDN.NET, All Rights Reserved
GongshangLogo