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

📄 form1.cs

📁 一个用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.Runtime.InteropServices;
//using System.Xml;
//using System.Collections.Specialized;
//using System.Reflection;
//using System.Diagnostics;

namespace JiShiBen
{
	/// <summary>
	/// Form1 的摘要说明。
	/// </summary>
	public class MainFrom : System.Windows.Forms.Form
	{
		private System.Windows.Forms.MenuItem menufile;
		private System.Windows.Forms.MenuItem menufile_new;
		private System.Windows.Forms.MainMenu mainMenu1;
		private System.Windows.Forms.MenuItem menufile_open;
		private System.Windows.Forms.MenuItem menufile_save;
		private System.Windows.Forms.MenuItem menuItem1;
		private System.Windows.Forms.MenuItem menufile_exit;
		private System.Windows.Forms.MenuItem menufile_saveas;
		private string filename;
		private System.Windows.Forms.MenuItem menuedit;
		private System.Windows.Forms.MenuItem menuedit_undo;
		private System.Windows.Forms.MenuItem menuItem4;
		private System.Windows.Forms.MenuItem menuedit_cut;
		private System.Windows.Forms.MenuItem menuedit_copy;
		private System.Windows.Forms.MenuItem menuedit_patse;
		private System.Windows.Forms.MenuItem menuedit_del;
		private System.Windows.Forms.MenuItem menuItem9;
		private System.Windows.Forms.MenuItem menuedit_quanxun;
		private System.Windows.Forms.MenuItem menuedit_clear;
		private System.Windows.Forms.MenuItem menuformat;
		private System.Windows.Forms.MenuItem menuformat_font;
		private System.Windows.Forms.RichTextBox textBox1;
		private System.Windows.Forms.MenuItem menuItem2;
		private System.Windows.Forms.MenuItem menuItem3;
		private System.Windows.Forms.MenuItem menuview;
		private System.Windows.Forms.MenuItem menuview_tools;
		private System.Windows.Forms.MenuItem menuview_zhuangtai;
		private System.Windows.Forms.MenuItem menuhelp;
		private System.Windows.Forms.MenuItem menuhelp_about;
		private System.Windows.Forms.StatusBar statusBar1;
		private System.Windows.Forms.ContextMenu contextMenu1;
		private System.Windows.Forms.MenuItem menuItem5;
		private System.Windows.Forms.MenuItem menuItem6;
		private System.Windows.Forms.MenuItem menuItem7;
		private System.Windows.Forms.MenuItem menuItem8;
		private System.Windows.Forms.MenuItem menuedit_chongfu;
		private System.Windows.Forms.MenuItem menuItem10;
		private System.Windows.Forms.MenuItem menuItem11;
		private System.Windows.Forms.MenuItem menuItem12;
		private System.Windows.Forms.MenuItem menuItem13;
		private System.Windows.Forms.MenuItem menuItem14;
		private System.Windows.Forms.MenuItem menuItem15;
		private System.Windows.Forms.MenuItem menuItem16;
		private System.Windows.Forms.StatusBarPanel statusBarPanel1;
		private System.Windows.Forms.StatusBarPanel statusBarPanel2;			
		/// <summary>
		/// 必需的设计器变量。
		/// </summary>
		private System.ComponentModel.Container components = null;

		public MainFrom()
		{
			//
			// Windows 窗体设计器支持所必需的
			//
			InitializeComponent();

			//
			// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
			//
		}

		/// <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()
		{
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(MainFrom));
			this.mainMenu1 = new System.Windows.Forms.MainMenu();
			this.menufile = new System.Windows.Forms.MenuItem();
			this.menufile_new = new System.Windows.Forms.MenuItem();
			this.menufile_open = new System.Windows.Forms.MenuItem();
			this.menufile_save = new System.Windows.Forms.MenuItem();
			this.menufile_saveas = new System.Windows.Forms.MenuItem();
			this.menuItem1 = new System.Windows.Forms.MenuItem();
			this.menufile_exit = new System.Windows.Forms.MenuItem();
			this.menuedit = new System.Windows.Forms.MenuItem();
			this.menuedit_chongfu = new System.Windows.Forms.MenuItem();
			this.menuedit_undo = new System.Windows.Forms.MenuItem();
			this.menuItem4 = new System.Windows.Forms.MenuItem();
			this.menuedit_cut = new System.Windows.Forms.MenuItem();
			this.menuedit_copy = new System.Windows.Forms.MenuItem();
			this.menuedit_patse = new System.Windows.Forms.MenuItem();
			this.menuedit_del = new System.Windows.Forms.MenuItem();
			this.menuItem9 = new System.Windows.Forms.MenuItem();
			this.menuedit_quanxun = new System.Windows.Forms.MenuItem();
			this.menuedit_clear = new System.Windows.Forms.MenuItem();
			this.menuformat = new System.Windows.Forms.MenuItem();
			this.menuformat_font = new System.Windows.Forms.MenuItem();
			this.menuItem2 = new System.Windows.Forms.MenuItem();
			this.menuItem3 = new System.Windows.Forms.MenuItem();
			this.menuview = new System.Windows.Forms.MenuItem();
			this.menuview_tools = new System.Windows.Forms.MenuItem();
			this.menuview_zhuangtai = new System.Windows.Forms.MenuItem();
			this.menuhelp = new System.Windows.Forms.MenuItem();
			this.menuhelp_about = new System.Windows.Forms.MenuItem();
			this.textBox1 = new System.Windows.Forms.RichTextBox();
			this.contextMenu1 = new System.Windows.Forms.ContextMenu();
			this.menuItem5 = new System.Windows.Forms.MenuItem();
			this.menuItem6 = new System.Windows.Forms.MenuItem();
			this.menuItem7 = new System.Windows.Forms.MenuItem();
			this.menuItem8 = new System.Windows.Forms.MenuItem();
			this.menuItem10 = new System.Windows.Forms.MenuItem();
			this.menuItem11 = new System.Windows.Forms.MenuItem();
			this.menuItem12 = new System.Windows.Forms.MenuItem();
			this.menuItem13 = new System.Windows.Forms.MenuItem();
			this.menuItem15 = new System.Windows.Forms.MenuItem();
			this.menuItem14 = new System.Windows.Forms.MenuItem();
			this.menuItem16 = new System.Windows.Forms.MenuItem();
			this.statusBar1 = new System.Windows.Forms.StatusBar();
			this.statusBarPanel1 = new System.Windows.Forms.StatusBarPanel();
			this.statusBarPanel2 = new System.Windows.Forms.StatusBarPanel();
			((System.ComponentModel.ISupportInitialize)(this.statusBarPanel1)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.statusBarPanel2)).BeginInit();
			this.SuspendLayout();
			// 
			// mainMenu1
			// 
			this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																					  this.menufile,
																					  this.menuedit,
																					  this.menuformat,
																					  this.menuview,
																					  this.menuhelp});
			// 
			// menufile
			// 
			this.menufile.Index = 0;
			this.menufile.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																					 this.menufile_new,
																					 this.menufile_open,
																					 this.menufile_save,
																					 this.menufile_saveas,
																					 this.menuItem1,
																					 this.menufile_exit});
			this.menufile.Text = "文件(&F)";
			// 
			// menufile_new
			// 
			this.menufile_new.Index = 0;
			this.menufile_new.Shortcut = System.Windows.Forms.Shortcut.CtrlN;
			this.menufile_new.Text = "新建";
			this.menufile_new.Click += new System.EventHandler(this.menufile_new_Click);
			// 
			// menufile_open
			// 
			this.menufile_open.Index = 1;
			this.menufile_open.Text = "打开";
			this.menufile_open.Click += new System.EventHandler(this.menufile_open_Click);
			// 
			// menufile_save
			// 
			this.menufile_save.Index = 2;
			this.menufile_save.Shortcut = System.Windows.Forms.Shortcut.CtrlS;
			this.menufile_save.Text = "保存";
			this.menufile_save.Click += new System.EventHandler(this.menufile_save_Click);
			// 
			// menufile_saveas
			// 
			this.menufile_saveas.Index = 3;
			this.menufile_saveas.Text = "另存为";
			this.menufile_saveas.Click += new System.EventHandler(this.menufile_saveas_Click);
			// 
			// menuItem1
			// 
			this.menuItem1.Index = 4;
			this.menuItem1.Text = "-";
			// 
			// menufile_exit
			// 
			this.menufile_exit.Index = 5;
			this.menufile_exit.Text = "退出";
			this.menufile_exit.Click += new System.EventHandler(this.menufile_exit_Click);
			// 
			// menuedit
			// 
			this.menuedit.Index = 1;
			this.menuedit.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																					 this.menuedit_chongfu,
																					 this.menuedit_undo,
																					 this.menuItem4,
																					 this.menuedit_cut,
																					 this.menuedit_copy,
																					 this.menuedit_patse,
																					 this.menuedit_del,
																					 this.menuItem9,
																					 this.menuedit_quanxun,
																					 this.menuedit_clear});
			this.menuedit.Text = "编辑(&E)";
			// 
			// menuedit_chongfu
			// 
			this.menuedit_chongfu.Index = 0;
			this.menuedit_chongfu.Text = "重复";
			this.menuedit_chongfu.Click += new System.EventHandler(this.menuedit_chongfu_Click);
			// 
			// menuedit_undo
			// 
			this.menuedit_undo.Index = 1;
			this.menuedit_undo.Text = "撤消";
			this.menuedit_undo.Click += new System.EventHandler(this.menuedit_undo_Click);
			// 
			// menuItem4
			// 
			this.menuItem4.Index = 2;
			this.menuItem4.Text = "-";
			// 
			// menuedit_cut
			// 
			this.menuedit_cut.Index = 3;
			this.menuedit_cut.Text = "剪切";
			this.menuedit_cut.Click += new System.EventHandler(this.menuedit_cut_Click);
			// 
			// menuedit_copy
			// 
			this.menuedit_copy.Index = 4;
			this.menuedit_copy.Text = "复制";
			this.menuedit_copy.Click += new System.EventHandler(this.menuedit_copy_Click);
			// 
			// menuedit_patse
			// 
			this.menuedit_patse.Index = 5;
			this.menuedit_patse.Text = "粘贴";
			this.menuedit_patse.Click += new System.EventHandler(this.menuedit_patse_Click);
			// 
			// menuedit_del
			// 
			this.menuedit_del.Index = 6;
			this.menuedit_del.Text = "删除";
			this.menuedit_del.Click += new System.EventHandler(this.menuedit_del_Click);
			// 
			// menuItem9
			// 
			this.menuItem9.Index = 7;
			this.menuItem9.Text = "-";
			// 
			// menuedit_quanxun
			// 
			this.menuedit_quanxun.Index = 8;
			this.menuedit_quanxun.Text = "全选";
			this.menuedit_quanxun.Click += new System.EventHandler(this.menuedit_quanxun_Click);
			// 
			// menuedit_clear
			// 
			this.menuedit_clear.Index = 9;
			this.menuedit_clear.Text = "清空";
			this.menuedit_clear.Click += new System.EventHandler(this.menuedit_clear_Click);
			// 
			// menuformat
			// 
			this.menuformat.Index = 2;
			this.menuformat.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																					   this.menuformat_font,
																					   this.menuItem2,
																					   this.menuItem3});
			this.menuformat.Text = "格式(&O)";
			// 
			// menuformat_font
			// 
			this.menuformat_font.Index = 0;
			this.menuformat_font.Text = "字体";
			this.menuformat_font.Click += new System.EventHandler(this.menuformat_font_Click);
			// 
			// menuItem2
			// 
			this.menuItem2.Index = 1;
			this.menuItem2.Text = "字体颜色";
			this.menuItem2.Click += new System.EventHandler(this.menuItem2_Click);
			// 
			// menuItem3
			// 
			this.menuItem3.Index = 2;
			this.menuItem3.Text = "背景颜色";
			this.menuItem3.Click += new System.EventHandler(this.menuItem3_Click);
			// 
			// menuview
			// 
			this.menuview.Index = 3;
			this.menuview.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																					 this.menuview_tools,
																					 this.menuview_zhuangtai});
			this.menuview.Text = "查看(&V)";
			// 
			// menuview_tools
			// 
			this.menuview_tools.Index = 0;
			this.menuview_tools.Text = "工具栏";
			// 
			// menuview_zhuangtai
			// 
			this.menuview_zhuangtai.Checked = true;
			this.menuview_zhuangtai.Index = 1;
			this.menuview_zhuangtai.Text = "状态栏";
			this.menuview_zhuangtai.Click += new System.EventHandler(this.menuview_zhuangtai_Click);
			// 
			// menuhelp
			// 
			this.menuhelp.Index = 4;
			this.menuhelp.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																					 this.menuhelp_about});
			this.menuhelp.Text = "帮助(&H)";
			// 
			// menuhelp_about
			// 
			this.menuhelp_about.Index = 0;
			this.menuhelp_about.Shortcut = System.Windows.Forms.Shortcut.F2;
			this.menuhelp_about.Text = "关于本程序";
			this.menuhelp_about.Click += new System.EventHandler(this.menuhelp_about_Click);
			// 
			// textBox1
			// 
			this.textBox1.AcceptsTab = true;
			this.textBox1.AutoSize = true;
			this.textBox1.ContextMenu = this.contextMenu1;
			this.textBox1.Dock = System.Windows.Forms.DockStyle.Fill;
			this.textBox1.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.textBox1.ImeMode = System.Windows.Forms.ImeMode.On;
			this.textBox1.Location = new System.Drawing.Point(0, 0);
			this.textBox1.Name = "textBox1";
			this.textBox1.Size = new System.Drawing.Size(642, 394);
			this.textBox1.TabIndex = 0;
			this.textBox1.Text = "";
			// 
			// contextMenu1
			// 
			this.contextMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																						 this.menuItem5,
																						 this.menuItem6,
																						 this.menuItem7,
																						 this.menuItem8,
																						 this.menuItem10,
																						 this.menuItem11,
																						 this.menuItem12,
																						 this.menuItem13,
																						 this.menuItem15,
																						 this.menuItem14,
																						 this.menuItem16});
			// 
			// menuItem5
			// 
			this.menuItem5.Index = 0;
			this.menuItem5.Text = "剪切";
			this.menuItem5.Click += new System.EventHandler(this.menuItem5_Click);
			// 
			// menuItem6
			// 
			this.menuItem6.Index = 1;
			this.menuItem6.Text = "复制";
			this.menuItem6.Click += new System.EventHandler(this.menuItem6_Click);
			// 
			// menuItem7
			// 
			this.menuItem7.Index = 2;
			this.menuItem7.Text = "粘贴";
			this.menuItem7.Click += new System.EventHandler(this.menuItem7_Click);
			// 

⌨️ 快捷键说明

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