📄 form1.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace Student
{
/// <summary>
/// Form1 的摘要说明。
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
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 txtNumber;
private System.Windows.Forms.TextBox TxtName;
private System.Windows.Forms.TextBox TxtDate;
private System.Windows.Forms.TextBox TxtTel;
private System.Windows.Forms.Button BtFind;
private System.Windows.Forms.Button BtExit;
internal System.Windows.Forms.Label Label6;
internal System.Windows.Forms.TextBox txtSearch;
internal System.Windows.Forms.ComboBox CmbSearch;
internal System.Windows.Forms.Label Label5;
internal System.Windows.Forms.MainMenu MainMenu1;
internal System.Windows.Forms.MenuItem MenuItem1;
internal System.Windows.Forms.MenuItem myontop;
internal System.Windows.Forms.MenuItem MyExit;
internal 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 MenuItem4;
internal System.Windows.Forms.MenuItem MenuItem8;
internal System.Windows.Forms.MenuItem MenuItem9;
private System.Windows.Forms.Button BtEdit;
private System.Windows.Forms.Button BtDelete;
private System.Windows.Forms.Button BtAdd;
private System.Windows.Forms.Button BtLast;
private System.Windows.Forms.Button BtFirst;
private System.Windows.Forms.Button BtNext;
private System.Windows.Forms.Button BtPre;
internal System.Windows.Forms.NotifyIcon NotifyIcon1;
internal System.Windows.Forms.ContextMenu myIconMenu;
internal System.Windows.Forms.MenuItem MenuItem2;
internal System.Windows.Forms.MenuItem MenuItem12;
internal System.Windows.Forms.MonthCalendar MonthCalendar1;
internal System.Windows.Forms.Button Cal;
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.TxtDate = 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.BtEdit = new System.Windows.Forms.Button();
this.BtDelete = new System.Windows.Forms.Button();
this.BtAdd = new System.Windows.Forms.Button();
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.Cal = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// BtFind
//
this.BtFind.Location = new System.Drawing.Point(304, 208);
this.BtFind.Name = "BtFind";
this.BtFind.Size = new System.Drawing.Size(96, 24);
this.BtFind.TabIndex = 7;
this.BtFind.Text = "查找&F";
this.BtFind.Click += new System.EventHandler(this.BtFind_Click);
//
// BtExit
//
this.BtExit.Location = new System.Drawing.Point(24, 216);
this.BtExit.Name = "BtExit";
this.BtExit.Size = new System.Drawing.Size(144, 24);
this.BtExit.TabIndex = 8;
this.BtExit.Text = "退出&T";
this.BtExit.Click += new System.EventHandler(this.BtExit_Click);
//
// label1
//
this.label1.Location = new System.Drawing.Point(24, 32);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(32, 16);
this.label1.TabIndex = 9;
this.label1.Text = "学号";
//
// txtNumber
//
this.txtNumber.Location = new System.Drawing.Point(72, 32);
this.txtNumber.Name = "txtNumber";
this.txtNumber.TabIndex = 10;
this.txtNumber.Text = "";
//
// TxtName
//
this.TxtName.Location = new System.Drawing.Point(72, 72);
this.TxtName.Name = "TxtName";
this.TxtName.TabIndex = 12;
this.TxtName.Text = "";
//
// label2
//
this.label2.Location = new System.Drawing.Point(24, 72);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(32, 16);
this.label2.TabIndex = 11;
this.label2.Text = "名称";
//
// TxtDate
//
this.TxtDate.Location = new System.Drawing.Point(72, 112);
this.TxtDate.Name = "TxtDate";
this.TxtDate.TabIndex = 14;
this.TxtDate.Text = "";
//
// label3
//
this.label3.Location = new System.Drawing.Point(24, 112);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(32, 16);
this.label3.TabIndex = 13;
this.label3.Text = "生日";
//
// TxtTel
//
this.TxtTel.Location = new System.Drawing.Point(72, 144);
this.TxtTel.Name = "TxtTel";
this.TxtTel.TabIndex = 16;
this.TxtTel.Text = "";
//
// label4
//
this.label4.Location = new System.Drawing.Point(24, 144);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(32, 16);
this.label4.TabIndex = 15;
this.label4.Text = "电话";
//
// Label6
//
this.Label6.Location = new System.Drawing.Point(304, 136);
this.Label6.Name = "Label6";
this.Label6.Size = new System.Drawing.Size(96, 20);
this.Label6.TabIndex = 21;
this.Label6.Text = "填写查询条件";
//
// txtSearch
//
this.txtSearch.Location = new System.Drawing.Point(304, 168);
this.txtSearch.Name = "txtSearch";
this.txtSearch.Size = new System.Drawing.Size(96, 21);
this.txtSearch.TabIndex = 20;
this.txtSearch.Text = "";
//
// CmbSearch
//
this.CmbSearch.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.CmbSearch.DropDownWidth = 96;
this.CmbSearch.Items.AddRange(new object[] {
"学号",
"名字",
"电话号码"});
this.CmbSearch.Location = new System.Drawing.Point(304, 104);
this.CmbSearch.Name = "CmbSearch";
this.CmbSearch.Size = new System.Drawing.Size(96, 20);
this.CmbSearch.TabIndex = 19;
//
// Label5
//
this.Label5.Location = new System.Drawing.Point(304, 72);
this.Label5.Name = "Label5";
this.Label5.Size = new System.Drawing.Size(96, 20);
this.Label5.TabIndex = 18;
this.Label5.Text = "选择查询条件";
//
// MainMenu1
//
this.MainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.MenuItem1,
this.MenuItem3,
this.MenuItem4});
//
// 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 = "退出";
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);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -