⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.cs

📁 这个东西是我使用c#语言写的c--词法分析器
💻 CS
📖 第 1 页 / 共 2 页
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.IO;
using System.Collections.Generic;

namespace accidenceAnalyser
{
    /// <summary>
    /// Form1 的摘要说明。
    /// </summary>
    public class Form1 : System.Windows.Forms.Form
    {
        private System.Windows.Forms.MainMenu mainMenu1;
        private System.Windows.Forms.OpenFileDialog openFileDialog1;
        private System.Windows.Forms.MenuItem filemune;
        private System.Windows.Forms.MenuItem open;
        private System.Windows.Forms.MenuItem save;
        private System.Windows.Forms.MenuItem saveas;
        private System.Windows.Forms.MenuItem operation;
        private System.Windows.Forms.MenuItem analyze;
        private IContainer components;
        private SaveFileDialog saveFileDialog1;
        //文件路径
        private string path = "";
        //文件内容
        private string fileContents = "";
        private MenuItem saveresult;
        private Label label1;
        private Label label2;
        private Button button1;
        private Button button2;
        private RichTextBox richTextBox1;
        private RichTextBox result;
        private Label label3;
        //关闭标志
        private bool closeFlag = false;       

        public Form1()
        {
            InitializeComponent();
            this.Cursor = System.Windows.Forms.Cursors.Hand;
        }

        /// <summary>
        /// 清理所有正在使用的资源。
        /// </summary>
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (components != null)
                {
                    components.Dispose();
                }
            }
            base.Dispose(disposing);
        }

        #region Windows 窗体设计器生成的代码
        /// <summary>
        /// 设计器支持所需的方法 - 不要使用代码编辑器修改
        /// 此方法的内容。
        /// </summary>
        private void InitializeComponent()
        {
            this.components = new System.ComponentModel.Container();
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
            this.mainMenu1 = new System.Windows.Forms.MainMenu(this.components);
            this.filemune = new System.Windows.Forms.MenuItem();
            this.open = new System.Windows.Forms.MenuItem();
            this.save = new System.Windows.Forms.MenuItem();
            this.saveas = new System.Windows.Forms.MenuItem();
            this.operation = new System.Windows.Forms.MenuItem();
            this.analyze = new System.Windows.Forms.MenuItem();
            this.saveresult = new System.Windows.Forms.MenuItem();
            this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
            this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
            this.label1 = new System.Windows.Forms.Label();
            this.label2 = new System.Windows.Forms.Label();
            this.button1 = new System.Windows.Forms.Button();
            this.button2 = new System.Windows.Forms.Button();
            this.richTextBox1 = new System.Windows.Forms.RichTextBox();
            this.result = new System.Windows.Forms.RichTextBox();
            this.label3 = new System.Windows.Forms.Label();
            this.SuspendLayout();
            // 
            // mainMenu1
            // 
            this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
            this.filemune,
            this.operation});
            // 
            // filemune
            // 
            this.filemune.Index = 0;
            this.filemune.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
            this.open,
            this.save,
            this.saveas});
            this.filemune.Text = "文件(&F)";
            // 
            // open
            // 
            this.open.Index = 0;
            this.open.Shortcut = System.Windows.Forms.Shortcut.CtrlO;
            this.open.Text = "打开(&O)";
            this.open.Click += new System.EventHandler(this.open_Click);
            // 
            // save
            // 
            this.save.Index = 1;
            this.save.Shortcut = System.Windows.Forms.Shortcut.CtrlS;
            this.save.Text = "保存(&S)";
            this.save.Click += new System.EventHandler(this.save_Click);
            // 
            // saveas
            // 
            this.saveas.Index = 2;
            this.saveas.Shortcut = System.Windows.Forms.Shortcut.CtrlShiftS;
            this.saveas.Text = "另存为(&V)";
            this.saveas.Click += new System.EventHandler(this.saveas_Click);
            // 
            // operation
            // 
            this.operation.Index = 1;
            this.operation.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
            this.analyze,
            this.saveresult});
            this.operation.Text = "词法分析 (&A)";
            // 
            // analyze
            // 
            this.analyze.Index = 0;
            this.analyze.Shortcut = System.Windows.Forms.Shortcut.F5;
            this.analyze.Text = "分析(&D)";
            this.analyze.Click += new System.EventHandler(this.analyze_Click);
            // 
            // saveresult
            // 
            this.saveresult.Index = 1;
            this.saveresult.Shortcut = System.Windows.Forms.Shortcut.CtrlShiftR;
            this.saveresult.Text = "保存分析结果(&E)";
            this.saveresult.Click += new System.EventHandler(this.saveresult_Click);
            // 
            // openFileDialog1
            // 
            this.openFileDialog1.Filter = "文本文件(*.txt)|*.txt|所有文件(*.*)|*.*";
            this.openFileDialog1.Title = "请选择你想要打开的文件";
            // 
            // saveFileDialog1
            // 
            this.saveFileDialog1.Filter = "文本文件(*.txt)|*.txt";
            this.saveFileDialog1.Title = "选择你要保存的文件类型";
            // 
            // label1
            // 
            this.label1.AutoSize = true;
            this.label1.Location = new System.Drawing.Point(766, 36);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(53, 12);
            this.label1.TabIndex = 2;
            this.label1.Text = "词法分析";
            // 
            // label2
            // 
            this.label2.AutoSize = true;
            this.label2.Location = new System.Drawing.Point(62, 36);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(29, 12);
            this.label2.TabIndex = 3;
            this.label2.Text = "源码";
            // 
            // button1
            // 
            this.button1.BackColor = System.Drawing.SystemColors.Control;
            this.button1.Image = ((System.Drawing.Image)(resources.GetObject("button1.Image")));
            this.button1.Location = new System.Drawing.Point(352, 604);
            this.button1.Name = "button1";
            this.button1.Size = new System.Drawing.Size(67, 37);
            this.button1.TabIndex = 4;
            this.button1.Text = "分析(&T)";
            this.button1.UseVisualStyleBackColor = false;
            this.button1.Click += new System.EventHandler(this.button1_Click);
            // 
            // button2
            // 
            this.button2.BackColor = System.Drawing.SystemColors.Control;
            this.button2.Image = ((System.Drawing.Image)(resources.GetObject("button2.Image")));
            this.button2.Location = new System.Drawing.Point(863, 604);
            this.button2.Name = "button2";
            this.button2.Size = new System.Drawing.Size(67, 37);
            this.button2.TabIndex = 5;
            this.button2.Text = "保存(&N)";
            this.button2.UseVisualStyleBackColor = false;
            this.button2.Click += new System.EventHandler(this.button2_Click);
            // 
            // richTextBox1
            // 
            this.richTextBox1.Location = new System.Drawing.Point(44, 65);
            this.richTextBox1.Name = "richTextBox1";
            this.richTextBox1.Size = new System.Drawing.Size(443, 516);
            this.richTextBox1.TabIndex = 6;
            this.richTextBox1.Text = "";
            // 
            // result
            // 
            this.result.Location = new System.Drawing.Point(540, 65);
            this.result.Name = "result";
            this.result.Size = new System.Drawing.Size(444, 516);
            this.result.TabIndex = 7;
            this.result.Text = "";
            // 
            // label3
            // 
            this.label3.AutoSize = true;
            this.label3.Font = new System.Drawing.Font("宋体", 13F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.label3.ForeColor = System.Drawing.Color.Fuchsia;
            this.label3.Location = new System.Drawing.Point(414, 19);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(170, 18);
            this.label3.TabIndex = 8;
            this.label3.Text = "欢迎使用词法分析器";
            // 
            // Form1
            // 
            this.AllowDrop = true;
            this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
            this.BackColor = System.Drawing.SystemColors.Control;
            this.ClientSize = new System.Drawing.Size(1014, 653);
            this.Controls.Add(this.label3);
            this.Controls.Add(this.result);
            this.Controls.Add(this.richTextBox1);
            this.Controls.Add(this.button2);
            this.Controls.Add(this.button1);
            this.Controls.Add(this.label2);
            this.Controls.Add(this.label1);
            this.ForeColor = System.Drawing.Color.Navy;
            this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            this.ImeMode = System.Windows.Forms.ImeMode.Off;
            this.Menu = this.mainMenu1;
            this.Name = "Form1";
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
            this.Text = "C--词法分析器";
            this.DragDrop += new System.Windows.Forms.DragEventHandler(this.Form1_DragDrop);
            this.Closing += new System.ComponentModel.CancelEventHandler(this.Form1_Closing);
            this.DragEnter += new System.Windows.Forms.DragEventHandler(this.Form1_DragEnter);
            this.Load += new System.EventHandler(this.Form1_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

        }
        #endregion

        /// <summary>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -