📄 editform.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace StudInfo
{
/// <summary>
/// EditForm 的摘要说明。
/// </summary>
public class EditForm : System.Windows.Forms.Form
{
public System.Windows.Forms.ComboBox comboBox2;
public System.Windows.Forms.NumericUpDown numericUpDown1;
public System.Windows.Forms.TextBox textBox2;
public System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label2;
public System.Windows.Forms.DomainUpDown domainUpDown1;
private System.Windows.Forms.Label label1;
private String eid,ename,esex,eage,edept;
private Microsoft.WindowsCE.Forms.InputPanel inputPanel1;
public EditForm(String sid,String sname,String ssex,String sage,String sdept)
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
eid=sid;
ename=sname;
esex=ssex;
eage=sage;
edept=sdept;
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
base.Dispose( disposing );
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.comboBox2 = new System.Windows.Forms.ComboBox();
this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
this.textBox2 = new System.Windows.Forms.TextBox();
this.textBox1 = new System.Windows.Forms.TextBox();
this.button2 = new System.Windows.Forms.Button();
this.button1 = new System.Windows.Forms.Button();
this.label5 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.domainUpDown1 = new System.Windows.Forms.DomainUpDown();
this.inputPanel1 = new Microsoft.WindowsCE.Forms.InputPanel();
//
// comboBox2
//
this.comboBox2.Items.Add("计算机系");
this.comboBox2.Items.Add("英语系");
this.comboBox2.Items.Add("艺术系");
this.comboBox2.Items.Add("管理系");
this.comboBox2.Items.Add("机电系");
this.comboBox2.Items.Add("园艺系");
this.comboBox2.Items.Add("中文系");
this.comboBox2.Location = new System.Drawing.Point(66, 125);
this.comboBox2.Size = new System.Drawing.Size(144, 20);
//
// numericUpDown1
//
this.numericUpDown1.Location = new System.Drawing.Point(66, 96);
this.numericUpDown1.Maximum = new System.Decimal(new int[] {
45,
0,
0,
0});
this.numericUpDown1.Minimum = new System.Decimal(new int[] {
15,
0,
0,
0});
this.numericUpDown1.Size = new System.Drawing.Size(64, 21);
this.numericUpDown1.Value = new System.Decimal(new int[] {
15,
0,
0,
0});
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(66, 38);
this.textBox2.Size = new System.Drawing.Size(144, 21);
this.textBox2.Text = "";
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(66, 9);
this.textBox1.Size = new System.Drawing.Size(144, 21);
this.textBox1.Text = "";
//
// button2
//
this.button2.Location = new System.Drawing.Point(120, 170);
this.button2.Size = new System.Drawing.Size(79, 30);
this.button2.Text = "取消";
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// button1
//
this.button1.Location = new System.Drawing.Point(18, 170);
this.button1.Size = new System.Drawing.Size(79, 30);
this.button1.Text = "确定";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// label5
//
this.label5.Location = new System.Drawing.Point(16, 125);
this.label5.Size = new System.Drawing.Size(48, 24);
this.label5.Text = "系部";
//
// label4
//
this.label4.Location = new System.Drawing.Point(16, 96);
this.label4.Size = new System.Drawing.Size(40, 16);
this.label4.Text = "年龄";
//
// label3
//
this.label3.Location = new System.Drawing.Point(16, 67);
this.label3.Size = new System.Drawing.Size(40, 24);
this.label3.Text = "性别";
//
// label2
//
this.label2.Location = new System.Drawing.Point(16, 38);
this.label2.Size = new System.Drawing.Size(32, 24);
this.label2.Text = "姓名";
//
// label1
//
this.label1.Location = new System.Drawing.Point(16, 9);
this.label1.Size = new System.Drawing.Size(40, 24);
this.label1.Text = "学号";
//
// domainUpDown1
//
this.domainUpDown1.Items.Add("男");
this.domainUpDown1.Items.Add("女");
this.domainUpDown1.Location = new System.Drawing.Point(66, 67);
this.domainUpDown1.Size = new System.Drawing.Size(64, 21);
//
// EditForm
//
this.ClientSize = new System.Drawing.Size(226, 223);
this.Controls.Add(this.domainUpDown1);
this.Controls.Add(this.comboBox2);
this.Controls.Add(this.numericUpDown1);
this.Controls.Add(this.textBox2);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Controls.Add(this.label5);
this.Controls.Add(this.label4);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Text = "编辑";
this.Load += new System.EventHandler(this.EditForm_Load);
}
#endregion
private void button1_Click(object sender, System.EventArgs e)
{
if ((textBox1.Text.ToString()=="")||(textBox1.Text.ToString()==""))
{
MessageBox.Show("学号或姓名不能为空!","错误",MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
}
else if ((domainUpDown1.Text.ToString()=="")||(domainUpDown1.Text.ToString()==""))
{
MessageBox.Show("性别或系部不能为空!","错误",MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
}
else
this.DialogResult = DialogResult.OK;
}
private void button2_Click(object sender, System.EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
}
private void bookInfo_GotFocus(object sender, System.EventArgs e)
{
inputPanel1.Enabled = true;
}
private void bookInfo_LostFocus(object sender, System.EventArgs e)
{
inputPanel1.Enabled = false;
}
private void EditForm_Load(object sender, System.EventArgs e)
{
this.textBox1.Text=eid;
this.textBox2.Text =ename;
this.domainUpDown1.Text=esex;
this.numericUpDown1.Text=eage;
this.comboBox2.Text =edept;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -