📄 form1.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace Employee
{
/// <summary>
/// Form1 的摘要说明。
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
internal System.Windows.Forms.MainMenu MainMenu1;
private System.Windows.Forms.MenuItem MenuItem1;
private System.Windows.Forms.MenuItem MenuItem2;
private System.Windows.Forms.MenuItem MenuItem3;
internal System.Windows.Forms.MenuItem mySearchNumber;
internal System.Windows.Forms.MenuItem mySearchName;
internal System.Windows.Forms.MenuItem mySearchTel;
internal System.Windows.Forms.MenuItem myontop;
internal System.Windows.Forms.MenuItem MyExit;
private System.Windows.Forms.MenuItem MenuItem4;
private System.Windows.Forms.MenuItem MenuItem8;
private System.Windows.Forms.MenuItem MenuItem9;
internal System.Windows.Forms.MenuItem MenuItem12;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.TextBox TxtName;
private System.Windows.Forms.TextBox TxtTel;
internal System.Windows.Forms.NotifyIcon NotifyIcon1;
internal System.Windows.Forms.ContextMenu myIconMenu;
private System.Windows.Forms.Button BtExit;
private System.Windows.Forms.Button BtPre;
private System.Windows.Forms.Button BtNext;
private System.Windows.Forms.Button BtFirst;
private System.Windows.Forms.Button BtLast;
private System.Windows.Forms.Label Label5;
internal System.Windows.Forms.Label Label6;
internal System.Windows.Forms.TextBox txtSearch;
private System.Windows.Forms.Button BtFind;
internal System.Windows.Forms.ComboBox CmbSearch;
internal System.Windows.Forms.MonthCalendar MonthCalendar1;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.TextBox TxtNumber;
private System.Windows.Forms.TextBox TxtSex;
private System.Windows.Forms.TextBox TxtAge;
private System.Windows.Forms.TextBox TxtJob;
private System.Windows.Forms.TextBox TxtAdd;
private System.Windows.Forms.MenuItem menuItem5;
private System.Windows.Forms.MenuItem menuEdit;
private System.Windows.Forms.MenuItem menuAdd;
private System.Windows.Forms.MenuItem menuDel;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.MenuItem menuItem6;
private System.Windows.Forms.MenuItem Mnotepad;
private System.Windows.Forms.MenuItem menuItem7;
private System.Windows.Forms.MenuItem menuItem10;
private System.ComponentModel.IContainer components;
public Form1()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//初始化组件
bool myResult;
//定义一个Short变量
myResult =OpenDb();
//调用opendb()打开数据库
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
this.BtFind = new System.Windows.Forms.Button();
this.BtExit = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.TxtNumber = new System.Windows.Forms.TextBox();
this.TxtName = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.TxtSex = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.TxtTel = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.Label6 = new System.Windows.Forms.Label();
this.txtSearch = new System.Windows.Forms.TextBox();
this.CmbSearch = new System.Windows.Forms.ComboBox();
this.Label5 = new System.Windows.Forms.Label();
this.MainMenu1 = new System.Windows.Forms.MainMenu();
this.MenuItem1 = new System.Windows.Forms.MenuItem();
this.myontop = new System.Windows.Forms.MenuItem();
this.MyExit = new System.Windows.Forms.MenuItem();
this.MenuItem3 = new System.Windows.Forms.MenuItem();
this.mySearchNumber = new System.Windows.Forms.MenuItem();
this.mySearchName = new System.Windows.Forms.MenuItem();
this.mySearchTel = new System.Windows.Forms.MenuItem();
this.MenuItem4 = new System.Windows.Forms.MenuItem();
this.MenuItem8 = new System.Windows.Forms.MenuItem();
this.MenuItem9 = new System.Windows.Forms.MenuItem();
this.menuItem5 = new System.Windows.Forms.MenuItem();
this.menuEdit = new System.Windows.Forms.MenuItem();
this.menuAdd = new System.Windows.Forms.MenuItem();
this.menuDel = new System.Windows.Forms.MenuItem();
this.menuItem6 = new System.Windows.Forms.MenuItem();
this.Mnotepad = new System.Windows.Forms.MenuItem();
this.BtLast = new System.Windows.Forms.Button();
this.BtFirst = new System.Windows.Forms.Button();
this.BtNext = new System.Windows.Forms.Button();
this.BtPre = new System.Windows.Forms.Button();
this.NotifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components);
this.myIconMenu = new System.Windows.Forms.ContextMenu();
this.MenuItem2 = new System.Windows.Forms.MenuItem();
this.MenuItem12 = new System.Windows.Forms.MenuItem();
this.MonthCalendar1 = new System.Windows.Forms.MonthCalendar();
this.label7 = new System.Windows.Forms.Label();
this.label8 = new System.Windows.Forms.Label();
this.label9 = new System.Windows.Forms.Label();
this.TxtAge = new System.Windows.Forms.TextBox();
this.TxtJob = new System.Windows.Forms.TextBox();
this.TxtAdd = new System.Windows.Forms.TextBox();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.label10 = new System.Windows.Forms.Label();
this.menuItem7 = new System.Windows.Forms.MenuItem();
this.menuItem10 = new System.Windows.Forms.MenuItem();
this.SuspendLayout();
//
// BtFind
//
this.BtFind.Location = new System.Drawing.Point(472, 240);
this.BtFind.Name = "BtFind";
this.BtFind.Size = new System.Drawing.Size(100, 21);
this.BtFind.TabIndex = 7;
this.BtFind.Text = "查询&Q";
this.BtFind.TextAlign = System.Drawing.ContentAlignment.TopCenter;
this.BtFind.Click += new System.EventHandler(this.BtFind_Click);
//
// BtExit
//
this.BtExit.Location = new System.Drawing.Point(472, 300);
this.BtExit.Name = "BtExit";
this.BtExit.Size = new System.Drawing.Size(100, 21);
this.BtExit.TabIndex = 8;
this.BtExit.Text = "退出系统";
this.BtExit.TextAlign = System.Drawing.ContentAlignment.TopCenter;
this.BtExit.Click += new System.EventHandler(this.BtExit_Click);
//
// label1
//
this.label1.Location = new System.Drawing.Point(0, 30);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(70, 21);
this.label1.TabIndex = 9;
this.label1.Text = "员工编号:";
this.label1.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
//
// TxtNumber
//
this.TxtNumber.BackColor = System.Drawing.Color.SpringGreen;
this.TxtNumber.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.TxtNumber.ForeColor = System.Drawing.Color.Red;
this.TxtNumber.Location = new System.Drawing.Point(75, 30);
this.TxtNumber.Name = "TxtNumber";
this.TxtNumber.TabIndex = 10;
this.TxtNumber.Text = "";
this.TxtNumber.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// TxtName
//
this.TxtName.BackColor = System.Drawing.Color.SpringGreen;
this.TxtName.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.TxtName.ForeColor = System.Drawing.Color.Red;
this.TxtName.Location = new System.Drawing.Point(75, 70);
this.TxtName.Name = "TxtName";
this.TxtName.TabIndex = 12;
this.TxtName.Text = "";
this.TxtName.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// label2
//
this.label2.Location = new System.Drawing.Point(0, 70);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(70, 21);
this.label2.TabIndex = 11;
this.label2.Text = "员工姓名:";
this.label2.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
//
// TxtSex
//
this.TxtSex.BackColor = System.Drawing.Color.SpringGreen;
this.TxtSex.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.TxtSex.ForeColor = System.Drawing.Color.Red;
this.TxtSex.Location = new System.Drawing.Point(75, 110);
this.TxtSex.Name = "TxtSex";
this.TxtSex.TabIndex = 14;
this.TxtSex.Text = "";
this.TxtSex.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// label3
//
this.label3.Location = new System.Drawing.Point(0, 110);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(70, 21);
this.label3.TabIndex = 13;
this.label3.Text = "员工性别:";
this.label3.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
//
// TxtTel
//
this.TxtTel.BackColor = System.Drawing.Color.SpringGreen;
this.TxtTel.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.TxtTel.ForeColor = System.Drawing.Color.Red;
this.TxtTel.Location = new System.Drawing.Point(75, 230);
this.TxtTel.Name = "TxtTel";
this.TxtTel.TabIndex = 16;
this.TxtTel.Text = "";
this.TxtTel.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// label4
//
this.label4.Location = new System.Drawing.Point(0, 230);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(70, 21);
this.label4.TabIndex = 15;
this.label4.Text = "联系电话:";
this.label4.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
//
// Label6
//
this.Label6.Location = new System.Drawing.Point(472, 150);
this.Label6.Name = "Label6";
this.Label6.Size = new System.Drawing.Size(100, 25);
this.Label6.TabIndex = 21;
this.Label6.Text = "填写查询条件:";
this.Label6.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
//
// txtSearch
//
this.txtSearch.BackColor = System.Drawing.Color.Cyan;
this.txtSearch.ForeColor = System.Drawing.Color.Red;
this.txtSearch.Location = new System.Drawing.Point(472, 190);
this.txtSearch.Name = "txtSearch";
this.txtSearch.TabIndex = 20;
this.txtSearch.Text = "";
//
// CmbSearch
//
this.CmbSearch.BackColor = System.Drawing.Color.Cyan;
this.CmbSearch.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.CmbSearch.DropDownWidth = 96;
this.CmbSearch.ForeColor = System.Drawing.Color.Red;
this.CmbSearch.Items.AddRange(new object[] {
"编号",
"姓名",
"电话"});
this.CmbSearch.Location = new System.Drawing.Point(320, 190);
this.CmbSearch.Name = "CmbSearch";
this.CmbSearch.Size = new System.Drawing.Size(100, 20);
this.CmbSearch.TabIndex = 19;
//
// Label5
//
this.Label5.Location = new System.Drawing.Point(320, 150);
this.Label5.Name = "Label5";
this.Label5.Size = new System.Drawing.Size(100, 25);
this.Label5.TabIndex = 18;
this.Label5.Text = "选择查询条件:";
this.Label5.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
//
// MainMenu1
//
this.MainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.MenuItem1,
this.MenuItem3,
this.MenuItem4,
this.menuItem5,
this.menuItem6,
this.menuItem7});
//
// MenuItem1
//
this.MenuItem1.Index = 0;
this.MenuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.myontop,
this.MyExit});
this.MenuItem1.Text = "文件(&F)";
//
// myontop
//
this.myontop.Index = 0;
this.myontop.Text = "保持在最顶层";
this.myontop.Click += new System.EventHandler(this.myontop_Click);
//
// MyExit
//
this.MyExit.Index = 1;
this.MyExit.Text = "退出(&X)";
this.MyExit.Click += new System.EventHandler(this.MyExit_Click);
//
// MenuItem3
//
this.MenuItem3.Index = 1;
this.MenuItem3.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.mySearchNumber,
this.mySearchName,
this.mySearchTel});
this.MenuItem3.Text = "查询(&S)";
//
// mySearchNumber
//
this.mySearchNumber.Index = 0;
this.mySearchNumber.Text = "按编号查询";
this.mySearchNumber.Click += new System.EventHandler(this.mySearchNumber_Click);
//
// mySearchName
//
this.mySearchName.Index = 1;
this.mySearchName.Text = "按名称查询";
this.mySearchName.Click += new System.EventHandler(this.mySearchName_Click);
//
// mySearchTel
//
this.mySearchTel.Index = 2;
this.mySearchTel.Text = "按电话查询";
this.mySearchTel.Click += new System.EventHandler(this.mySearchTel_Click);
//
// MenuItem4
//
this.MenuItem4.Index = 2;
this.MenuItem4.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.MenuItem8,
this.MenuItem9});
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -