C#窗体应用程序之 单选按钮与分组框 源代码
2014-05-25 15:53
211 查看
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());
}
}
}
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());
}
}
}
相关文章推荐
- C# 窗体应用程序 之 单选按钮的实现 源代码
- C#给WinForm(窗体)下DataGridView控件添加单选选或多选按钮列
- C#窗体控件-单选按钮控件RadioButton
- C# 选项、单选、多选、分组、MDI窗体的设计、PictureBox
- C#窗体应用(复选框,单选按钮,拖动水平滚动条)
- C#--第11周实验--任务3--设计一个窗体,窗体上有两个文本框,一个按钮,2个单选按钮--实现单击按钮后,根据单选按钮,将对应文本框中内容显示在标签。
- vb.net 与c# 窗体绘制水晶按钮图形
- C#窗体控制源代码
- 如何使用 C# .NET 在 ASP.NET 应用程序中实现基于窗体的身份验证
- vb.net 与c# 窗体绘制水晶按钮图形
- C#窗体应用程序中,实现调用已有应用程序
- 重写c# winform窗体关闭按钮
- SAP 开发陷阱一箩筐(05)——绘制屏幕时无法给单选按钮分组
- c#按钮透明及窗体关闭时产生透明渐变
- 在Release与Debug两种模式下生成C#窗体应用程序,在读写文件时的相对路径区别
- 使用 C# .NET 在 ASP.NET 应用程序中实现基于窗体的身份验证
- C# 修改注册表 达到 Windows Services 启动 窗体应用程序
- c#捕获窗体的最大化最小化按钮的事件
- c#捕获窗体的最大化最小化按钮的事件
- c# winForm窗体上的按钮结束回车确认