📄 form1.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Data.OleDb;
namespace homework
{
/// <summary>
/// Form1 的摘要说明。
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Button btnOK;
private System.Windows.Forms.Button btnExit;
private static int listBoxNo;
private static int CodeListNo;
private static int NumListNo;
private static int listBoxNo2;
private System.Windows.Forms.Button btnClear;
private System.Data.OleDb.OleDbConnection dbConnect;
private System.Windows.Forms.MainMenu mainMenu1;
private System.Windows.Forms.MenuItem menuItem1;
private System.Windows.Forms.MenuItem menuItem2;
private System.Windows.Forms.MenuItem menuItem3;
private System.Windows.Forms.MenuItem menuItem4;
private System.Windows.Forms.OpenFileDialog openFileDialog1;
private System.Windows.Forms.RichTextBox InCode;
private System.Windows.Forms.MenuItem menuItem5;
private System.Windows.Forms.SaveFileDialog saveFileDialog1;
private System.Windows.Forms.ListBox listBox2;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.ListBox listBox1;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.ListBox NumList;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.ListBox CodeList;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private class CharSet
{
public string type;
public int no;
public string character;
}
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public Form1()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.InCode = new System.Windows.Forms.RichTextBox();
this.btnOK = new System.Windows.Forms.Button();
this.btnExit = new System.Windows.Forms.Button();
this.btnClear = new System.Windows.Forms.Button();
this.dbConnect = new System.Data.OleDb.OleDbConnection();
this.mainMenu1 = new System.Windows.Forms.MainMenu();
this.menuItem1 = new System.Windows.Forms.MenuItem();
this.menuItem2 = new System.Windows.Forms.MenuItem();
this.menuItem5 = new System.Windows.Forms.MenuItem();
this.menuItem3 = new System.Windows.Forms.MenuItem();
this.menuItem4 = new System.Windows.Forms.MenuItem();
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
this.listBox2 = new System.Windows.Forms.ListBox();
this.label4 = new System.Windows.Forms.Label();
this.listBox1 = new System.Windows.Forms.ListBox();
this.label3 = new System.Windows.Forms.Label();
this.NumList = new System.Windows.Forms.ListBox();
this.label2 = new System.Windows.Forms.Label();
this.CodeList = new System.Windows.Forms.ListBox();
this.label1 = new System.Windows.Forms.Label();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.SuspendLayout();
//
// groupBox1
//
this.groupBox1.Controls.Add(this.InCode);
this.groupBox1.Location = new System.Drawing.Point(16, 40);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(240, 344);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "程序输入";
//
// InCode
//
this.InCode.Location = new System.Drawing.Point(8, 32);
this.InCode.Name = "InCode";
this.InCode.Size = new System.Drawing.Size(224, 304);
this.InCode.TabIndex = 0;
this.InCode.Text = "";
//
// btnOK
//
this.btnOK.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnOK.Location = new System.Drawing.Point(96, 400);
this.btnOK.Name = "btnOK";
this.btnOK.Size = new System.Drawing.Size(88, 32);
this.btnOK.TabIndex = 2;
this.btnOK.Text = "分 析";
this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
//
// btnExit
//
this.btnExit.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnExit.Location = new System.Drawing.Point(544, 400);
this.btnExit.Name = "btnExit";
this.btnExit.Size = new System.Drawing.Size(88, 32);
this.btnExit.TabIndex = 3;
this.btnExit.Text = "退 出";
this.btnExit.Click += new System.EventHandler(this.btnExit_Click);
//
// btnClear
//
this.btnClear.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnClear.Location = new System.Drawing.Point(320, 400);
this.btnClear.Name = "btnClear";
this.btnClear.Size = new System.Drawing.Size(88, 32);
this.btnClear.TabIndex = 4;
this.btnClear.Text = "清除全部";
this.btnClear.Click += new System.EventHandler(this.btnClear_Click);
//
// dbConnect
//
this.dbConnect.ConnectionString = @"Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Registry Path=;Jet OLEDB:Database Locking Mode=1;Data Source=""D:\学而时习\词法分析器\keytable.mdb"";Mode=Share Deny None;Jet OLEDB:Engine Type=5;Provider=""Microsoft.Jet.OLEDB.4.0"";Jet OLEDB:System database=;Jet OLEDB:SFP=False;persist security info=False;Extended Properties=;Jet OLEDB:Compact Without Replica Repair=False;Jet OLEDB:Encrypt Database=False;Jet OLEDB:Create System Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;User ID=Admin;Jet OLEDB:Global Bulk Transactions=1";
//
// mainMenu1
//
this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem1,
this.menuItem4});
//
// menuItem1
//
this.menuItem1.Index = 0;
this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem2,
this.menuItem5,
this.menuItem3});
this.menuItem1.Text = "文件";
//
// menuItem2
//
this.menuItem2.Index = 0;
this.menuItem2.Text = "打开";
this.menuItem2.Click += new System.EventHandler(this.menuItem2_Click);
//
// menuItem5
//
this.menuItem5.Index = 1;
this.menuItem5.Text = "保存";
this.menuItem5.Click += new System.EventHandler(this.menuItem5_Click);
//
// menuItem3
//
this.menuItem3.Index = 2;
this.menuItem3.Text = "退出";
this.menuItem3.Click += new System.EventHandler(this.menuItem3_Click);
//
// menuItem4
//
this.menuItem4.Index = 1;
this.menuItem4.Text = "帮助";
//
// listBox2
//
this.listBox2.ItemHeight = 12;
this.listBox2.Location = new System.Drawing.Point(200, 32);
this.listBox2.Name = "listBox2";
this.listBox2.Size = new System.Drawing.Size(224, 304);
this.listBox2.TabIndex = 8;
//
// label4
//
this.label4.Location = new System.Drawing.Point(200, 8);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(100, 16);
this.label4.TabIndex = 7;
this.label4.Text = "完全分析";
//
// listBox1
//
this.listBox1.ItemHeight = 12;
this.listBox1.Location = new System.Drawing.Point(8, 200);
this.listBox1.Name = "listBox1";
this.listBox1.Size = new System.Drawing.Size(176, 136);
this.listBox1.TabIndex = 5;
//
// label3
//
this.label3.Location = new System.Drawing.Point(8, 184);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(100, 16);
this.label3.TabIndex = 4;
this.label3.Text = "单词序列";
//
// NumList
//
this.NumList.ItemHeight = 12;
this.NumList.Location = new System.Drawing.Point(8, 112);
this.NumList.Name = "NumList";
this.NumList.Size = new System.Drawing.Size(176, 64);
this.NumList.TabIndex = 3;
//
// label2
//
this.label2.Location = new System.Drawing.Point(8, 96);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(100, 16);
this.label2.TabIndex = 2;
this.label2.Text = "常数表";
//
// CodeList
//
this.CodeList.ItemHeight = 12;
this.CodeList.Location = new System.Drawing.Point(8, 32);
this.CodeList.Name = "CodeList";
this.CodeList.Size = new System.Drawing.Size(176, 64);
this.CodeList.TabIndex = 1;
//
// label1
//
this.label1.Location = new System.Drawing.Point(8, 16);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(104, 16);
this.label1.TabIndex = 9;
this.label1.Text = "标识符表";
//
// groupBox2
//
this.groupBox2.Controls.Add(this.listBox2);
this.groupBox2.Controls.Add(this.label4);
this.groupBox2.Controls.Add(this.listBox1);
this.groupBox2.Controls.Add(this.label3);
this.groupBox2.Controls.Add(this.NumList);
this.groupBox2.Controls.Add(this.label2);
this.groupBox2.Controls.Add(this.CodeList);
this.groupBox2.Controls.Add(this.label1);
this.groupBox2.Location = new System.Drawing.Point(272, 40);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(432, 344);
this.groupBox2.TabIndex = 1;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "机内识别结果";
//
// button1
//
this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button1.Location = new System.Drawing.Point(432, 400);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(88, 32);
this.button1.TabIndex = 5;
this.button1.Text = "清除分析";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button2.Location = new System.Drawing.Point(208, 400);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(88, 32);
this.button2.TabIndex = 6;
this.button2.Text = "清除程序";
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(712, 470);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Controls.Add(this.btnClear);
this.Controls.Add(this.btnExit);
this.Controls.Add(this.btnOK);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1);
this.Menu = this.mainMenu1;
this.Name = "Form1";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Form1";
this.Load += new System.EventHandler(this.Form1_Load);
this.groupBox1.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
this.ResumeLayout(false);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -