C#窗体应用程序之 单选按钮与分组框 源代码

using System.Windows.Forms;
using System.Drawing;
using System;
namespace lx21
{
    public partial class Form2 : Form
    {
        //private Label LSex;
       // private Label LMarry;
        private GroupBox gbSex;
        private GroupBox gbMarry;
        private RadioButton rbMan;
        private RadioButton rbWomen;
        private RadioButton rbMarried;
        private RadioButton rbSignal;
        private Button btnOK;


        public Form2()
        {
            InitializeComponent();
        }
        private void InitializeComponent()
        {
           // this.LSex = new Label();
           // this.LMarry = new Label();
            this.gbSex = new GroupBox();
            this.gbMarry = new GroupBox();
            this.rbMan = new RadioButton();
            this.rbMarried = new RadioButton();
            this.rbSignal = new RadioButton();
            this.rbWomen = new RadioButton();
            this.btnOK = new Button();


            //this.ClientSize = new System.Drawing.Size(350, 225);
            this.ClientSize = new System.Drawing.Size(500,300);
            this.Text = "99问答";


            //this.LSex.Location = new Point(50, 50);
            //this.LSex.Size = new Size(50,50);
            //this.LSex.TabIndex = 0;
            //this.LSex.Text = "* 性别";
            this.gbSex.Location = new Point(50, 50);
            this.gbSex.Size = new Size(150, 160);
            this.gbSex.TabStop = false;
            this.gbSex.Text = "* 性别";


            //this.LMarry.Location = new Point(250, 50);
            //this.LMarry.Size = new Size(50,50);
            //this.LMarry.TabIndex = 1;
            //this.LMarry.Text = "* 婚否";
            this.gbMarry.Location = new Point(250, 50);
            this.gbMarry.Size = new Size(150, 160);
            this.gbMarry.TabStop = false;
            this.gbMarry.Text = "* 婚否";


            this.rbMan.Location = new Point(50, 50);
            this.rbMan.Size = new Size(50,50);
            this.rbMan.TabIndex = 2;
            this.rbMan.Text = "男";


            this.rbWomen.Location = new Point(50, 90);
            this.rbWomen.Size = new Size(50, 50);
            this.rbWomen.TabIndex = 3;
            this.rbWomen.Text = "女";


            this.rbSignal.Location = new Point(50, 50);
            this.rbSignal.Size = new Size(50, 50);
            this.rbSignal.TabIndex = 4;
            this.rbSignal.Text = "未婚";


            this.rbMarried.Location = new Point(50, 90);
            this.rbMarried.Size = new Size(50,  50);
            this.rbMarried.TabIndex = 5;
            this.rbMarried.Text = "已婚";


            this.btnOK.Location = new Point(200, 249);
            this.btnOK.Size = new Size(50,25);
            this.btnOK.TabIndex = 6;
            this.btnOK.Text = "提交";
            this.btnOK.Click += new EventHandler(this.btnOK_Click);


            //this.Controls.Add(LSex);
            //this.Controls.Add(LMarry);
            this.Controls.Add(gbSex);
            this.Controls.Add(gbMarry);


            //this.Controls.Add(rbMan);
            //this.Controls.Add(rbWomen);
            //this.Controls.Add(rbMarried);
            //this.Controls.Add(rbSignal);
            this.gbSex.Controls.Add(rbMan);
            this.gbSex.Controls.Add(rbWomen);
            this.gbMarry.Controls.Add(rbMarried);
            this.gbMarry.Controls.Add(rbSignal);
            this.Controls.Add(btnOK);
        }


        private void btnOK_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }


        static void Main()
        {
            Application.Run(new Form2());
        }
    }
}
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值