📄 frmstudent.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace Example_1
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Label lblName;
private System.Windows.Forms.GroupBox grpTrade;
private System.Windows.Forms.TextBox txtName;
private System.Windows.Forms.RadioButton radMedicine;
private System.Windows.Forms.RadioButton radEngineering;
private System.Windows.Forms.RadioButton radSocialScience;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.lblName = new System.Windows.Forms.Label();
this.grpTrade = new System.Windows.Forms.GroupBox();
this.radSocialScience = new System.Windows.Forms.RadioButton();
this.radEngineering = new System.Windows.Forms.RadioButton();
this.radMedicine = new System.Windows.Forms.RadioButton();
this.txtName = new System.Windows.Forms.TextBox();
this.grpTrade.SuspendLayout();
this.SuspendLayout();
//
// lblName
//
this.lblName.Location = new System.Drawing.Point(48, 22);
this.lblName.Name = "lblName";
this.lblName.Size = new System.Drawing.Size(120, 25);
this.lblName.TabIndex = 0;
this.lblName.Text = "学生姓名";
//
// grpTrade
//
this.grpTrade.Controls.Add(this.radSocialScience);
this.grpTrade.Controls.Add(this.radEngineering);
this.grpTrade.Controls.Add(this.radMedicine);
this.grpTrade.Location = new System.Drawing.Point(40, 78);
this.grpTrade.Name = "grpTrade";
this.grpTrade.Size = new System.Drawing.Size(221, 155);
this.grpTrade.TabIndex = 2;
this.grpTrade.TabStop = false;
this.grpTrade.Text = "选择行业";
//
// radSocialScience
//
this.radSocialScience.Location = new System.Drawing.Point(10, 112);
this.radSocialScience.Name = "radSocialScience";
this.radSocialScience.Size = new System.Drawing.Size(153, 17);
this.radSocialScience.TabIndex = 2;
this.radSocialScience.Text = "社会科学";
this.radSocialScience.CheckedChanged += new System.EventHandler(this.radSocialScience_CheckedChanged);
//
// radEngineering
//
this.radEngineering.Location = new System.Drawing.Point(10, 69);
this.radEngineering.Name = "radEngineering";
this.radEngineering.Size = new System.Drawing.Size(124, 26);
this.radEngineering.TabIndex = 1;
this.radEngineering.Text = "工程";
this.radEngineering.CheckedChanged += new System.EventHandler(this.radEngineering_CheckedChanged);
//
// radMedicine
//
this.radMedicine.Location = new System.Drawing.Point(10, 26);
this.radMedicine.Name = "radMedicine";
this.radMedicine.Size = new System.Drawing.Size(124, 26);
this.radMedicine.TabIndex = 0;
this.radMedicine.Text = "医学";
this.radMedicine.CheckedChanged += new System.EventHandler(this.radMedicine_CheckedChanged);
//
// txtName
//
this.txtName.Location = new System.Drawing.Point(112, 17);
this.txtName.Name = "txtName";
this.txtName.Size = new System.Drawing.Size(144, 21);
this.txtName.TabIndex = 3;
this.txtName.Text = "";
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(304, 277);
this.Controls.Add(this.txtName);
this.Controls.Add(this.grpTrade);
this.Controls.Add(this.lblName);
this.Name = "Form1";
this.Text = "学生窗体";
this.Load += new System.EventHandler(this.Form1_Load);
this.grpTrade.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void Form1_Load(object sender, System.EventArgs e)
{
}
private void radMedicine_CheckedChanged(object sender, System.EventArgs e)
{
MessageBox.Show(txtName.Text + "," + "您对医学专业感兴趣");
}
private void radEngineering_CheckedChanged(object sender, System.EventArgs e)
{
MessageBox.Show(txtName.Text + "," + "您对工程专业感兴趣");
}
private void radSocialScience_CheckedChanged(object sender, System.EventArgs e)
{
MessageBox.Show(txtName.Text + "," + "您对社会科学专业感兴趣");
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -