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

📄 form1.cs

📁 windows的记事本
💻 CS
📖 第 1 页 / 共 3 页
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.IO;
using System.Text;
using System.Runtime.InteropServices;


namespace notepad
{

	/// <summary>
	/// Form1 的摘要说明。
	/// </summary>
	public class NotePad : System.Windows.Forms.Form
	{
		//皮肤
		[DllImport("appface.dll")]
		public static extern long SkinStart(string SkinFile,int nDefWinType,string CheckSum,long nType,
			long hInstance,long nLen);
		[DllImport("appface.dll")]
		public static extern long SkinRemove() ;		
		[DllImport("appface.dll")]
		public static extern long SkinWindowSet(IntPtr hWnd,long nSkintype);
		//

		
		private System.Windows.Forms.SaveFileDialog saveFileDialog1;
		private System.Windows.Forms.FontDialog fontDialog1;
		private System.Windows.Forms.ColorDialog colorDialog1;
		private System.Windows.Forms.MenuItem menuItem7;
		private System.Windows.Forms.MenuItem menuItem10;
		private System.Windows.Forms.MenuItem menuItem15;
		/// <summary>
		/// 必需的设计器变量。
		
		private string CurrentFileName = "新建文本";
		private bool needtosave;
		private System.Windows.Forms.TextBox textBox;
		private System.Windows.Forms.MainMenu mainMenu;
		private System.Windows.Forms.OpenFileDialog openFileDialog1;
		private System.Windows.Forms.MenuItem menuItem24;
		private System.Windows.Forms.MenuItem menuItemAbout;
		private System.Windows.Forms.MenuItem menuItemNew;
		private System.Windows.Forms.MenuItem menuItemOpen;
		private System.Windows.Forms.MenuItem menuItemSave;
		private System.Windows.Forms.MenuItem menuItemSaveAs;
		private System.Windows.Forms.MenuItem menuItemExit;
		private System.Windows.Forms.MenuItem menuItemUndo;
		private System.Windows.Forms.MenuItem menuItemCut;
		private System.Windows.Forms.MenuItem menuItemCopy;
		private System.Windows.Forms.MenuItem menuItemPaste;
		private System.Windows.Forms.MenuItem menuItemDel;
		private System.Windows.Forms.MenuItem menuItemAll;
		private System.Windows.Forms.MenuItem menuItemTime;
		private System.Windows.Forms.MenuItem menuItemReturn;
		private System.Windows.Forms.MenuItem menuItemFont;
		private System.Windows.Forms.MenuItem menuItemBackcolor;
		private System.Windows.Forms.MenuItem menuItemFile;
		private System.Windows.Forms.MenuItem menuItemEdit;
		private System.Windows.Forms.MenuItem menuItemFormat;
		private System.Windows.Forms.MenuItem menuItemHelp;
		private System.Windows.Forms.MenuItem menuItem1;
		private System.Windows.Forms.MenuItem menuItem2;
		private System.Windows.Forms.MenuItem menuItem9;
		private System.Windows.Forms.MenuItem menuItemJingDian;
		private System.Windows.Forms.MenuItem menuItemChunTian;
		private System.Windows.Forms.MenuItem menuItemHejin;
		private System.Windows.Forms.MenuItem menuItemCancelSkin;
		private System.Windows.Forms.MenuItem menuItemLoadSkin;

		/// </summary>
		private System.ComponentModel.Container components = null;

		public NotePad()
		{
			//
			// 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(NotePad));
			this.mainMenu = new System.Windows.Forms.MainMenu();
			this.menuItemFile = new System.Windows.Forms.MenuItem();
			this.menuItemNew = new System.Windows.Forms.MenuItem();
			this.menuItem1 = new System.Windows.Forms.MenuItem();
			this.menuItemOpen = new System.Windows.Forms.MenuItem();
			this.menuItemSave = new System.Windows.Forms.MenuItem();
			this.menuItemSaveAs = new System.Windows.Forms.MenuItem();
			this.menuItem7 = new System.Windows.Forms.MenuItem();
			this.menuItemExit = new System.Windows.Forms.MenuItem();
			this.menuItemEdit = new System.Windows.Forms.MenuItem();
			this.menuItemUndo = new System.Windows.Forms.MenuItem();
			this.menuItem10 = new System.Windows.Forms.MenuItem();
			this.menuItemCut = new System.Windows.Forms.MenuItem();
			this.menuItemCopy = new System.Windows.Forms.MenuItem();
			this.menuItemPaste = new System.Windows.Forms.MenuItem();
			this.menuItemDel = new System.Windows.Forms.MenuItem();
			this.menuItem15 = new System.Windows.Forms.MenuItem();
			this.menuItemAll = new System.Windows.Forms.MenuItem();
			this.menuItemTime = new System.Windows.Forms.MenuItem();
			this.menuItem2 = new System.Windows.Forms.MenuItem();
			this.menuItemJingDian = new System.Windows.Forms.MenuItem();
			this.menuItemChunTian = new System.Windows.Forms.MenuItem();
			this.menuItemHejin = new System.Windows.Forms.MenuItem();
			this.menuItem9 = new System.Windows.Forms.MenuItem();
			this.menuItemCancelSkin = new System.Windows.Forms.MenuItem();
			this.menuItemLoadSkin = new System.Windows.Forms.MenuItem();
			this.menuItemFormat = new System.Windows.Forms.MenuItem();
			this.menuItemReturn = new System.Windows.Forms.MenuItem();
			this.menuItem24 = new System.Windows.Forms.MenuItem();
			this.menuItemFont = new System.Windows.Forms.MenuItem();
			this.menuItemBackcolor = new System.Windows.Forms.MenuItem();
			this.menuItemHelp = new System.Windows.Forms.MenuItem();
			this.menuItemAbout = new System.Windows.Forms.MenuItem();
			this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
			this.fontDialog1 = new System.Windows.Forms.FontDialog();
			this.colorDialog1 = new System.Windows.Forms.ColorDialog();
			this.textBox = new System.Windows.Forms.TextBox();
			this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
			this.SuspendLayout();
			// 
			// mainMenu
			// 
			this.mainMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																					 this.menuItemFile,
																					 this.menuItemEdit,
																					 this.menuItem2,
																					 this.menuItemFormat,
																					 this.menuItemHelp});
			this.mainMenu.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("mainMenu.RightToLeft")));
			// 
			// menuItemFile
			// 
			this.menuItemFile.Enabled = ((bool)(resources.GetObject("menuItemFile.Enabled")));
			this.menuItemFile.Index = 0;
			this.menuItemFile.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																						 this.menuItemNew,
																						 this.menuItem1,
																						 this.menuItemOpen,
																						 this.menuItemSave,
																						 this.menuItemSaveAs,
																						 this.menuItem7,
																						 this.menuItemExit});
			this.menuItemFile.Shortcut = ((System.Windows.Forms.Shortcut)(resources.GetObject("menuItemFile.Shortcut")));
			this.menuItemFile.ShowShortcut = ((bool)(resources.GetObject("menuItemFile.ShowShortcut")));
			this.menuItemFile.Text = resources.GetString("menuItemFile.Text");
			this.menuItemFile.Visible = ((bool)(resources.GetObject("menuItemFile.Visible")));
			// 
			// menuItemNew
			// 
			this.menuItemNew.Enabled = ((bool)(resources.GetObject("menuItemNew.Enabled")));
			this.menuItemNew.Index = 0;
			this.menuItemNew.Shortcut = ((System.Windows.Forms.Shortcut)(resources.GetObject("menuItemNew.Shortcut")));
			this.menuItemNew.ShowShortcut = ((bool)(resources.GetObject("menuItemNew.ShowShortcut")));
			this.menuItemNew.Text = resources.GetString("menuItemNew.Text");
			this.menuItemNew.Visible = ((bool)(resources.GetObject("menuItemNew.Visible")));
			this.menuItemNew.Click += new System.EventHandler(this.menuItemNew_Click);
			// 
			// menuItem1
			// 
			this.menuItem1.Enabled = ((bool)(resources.GetObject("menuItem1.Enabled")));
			this.menuItem1.Index = 1;
			this.menuItem1.Shortcut = ((System.Windows.Forms.Shortcut)(resources.GetObject("menuItem1.Shortcut")));
			this.menuItem1.ShowShortcut = ((bool)(resources.GetObject("menuItem1.ShowShortcut")));
			this.menuItem1.Text = resources.GetString("menuItem1.Text");
			this.menuItem1.Visible = ((bool)(resources.GetObject("menuItem1.Visible")));
			// 
			// menuItemOpen
			// 
			this.menuItemOpen.Enabled = ((bool)(resources.GetObject("menuItemOpen.Enabled")));
			this.menuItemOpen.Index = 2;
			this.menuItemOpen.Shortcut = ((System.Windows.Forms.Shortcut)(resources.GetObject("menuItemOpen.Shortcut")));
			this.menuItemOpen.ShowShortcut = ((bool)(resources.GetObject("menuItemOpen.ShowShortcut")));
			this.menuItemOpen.Text = resources.GetString("menuItemOpen.Text");
			this.menuItemOpen.Visible = ((bool)(resources.GetObject("menuItemOpen.Visible")));
			this.menuItemOpen.Click += new System.EventHandler(this.menuItemOpen_Click);
			// 
			// menuItemSave
			// 
			this.menuItemSave.Enabled = ((bool)(resources.GetObject("menuItemSave.Enabled")));
			this.menuItemSave.Index = 3;
			this.menuItemSave.Shortcut = ((System.Windows.Forms.Shortcut)(resources.GetObject("menuItemSave.Shortcut")));
			this.menuItemSave.ShowShortcut = ((bool)(resources.GetObject("menuItemSave.ShowShortcut")));
			this.menuItemSave.Text = resources.GetString("menuItemSave.Text");
			this.menuItemSave.Visible = ((bool)(resources.GetObject("menuItemSave.Visible")));
			this.menuItemSave.Click += new System.EventHandler(this.menuItemSave_Click);
			// 
			// menuItemSaveAs
			// 
			this.menuItemSaveAs.Enabled = ((bool)(resources.GetObject("menuItemSaveAs.Enabled")));
			this.menuItemSaveAs.Index = 4;
			this.menuItemSaveAs.Shortcut = ((System.Windows.Forms.Shortcut)(resources.GetObject("menuItemSaveAs.Shortcut")));
			this.menuItemSaveAs.ShowShortcut = ((bool)(resources.GetObject("menuItemSaveAs.ShowShortcut")));
			this.menuItemSaveAs.Text = resources.GetString("menuItemSaveAs.Text");
			this.menuItemSaveAs.Visible = ((bool)(resources.GetObject("menuItemSaveAs.Visible")));
			this.menuItemSaveAs.Click += new System.EventHandler(this.menuItemSaveAs_Click);
			// 
			// menuItem7
			// 
			this.menuItem7.Enabled = ((bool)(resources.GetObject("menuItem7.Enabled")));
			this.menuItem7.Index = 5;
			this.menuItem7.Shortcut = ((System.Windows.Forms.Shortcut)(resources.GetObject("menuItem7.Shortcut")));
			this.menuItem7.ShowShortcut = ((bool)(resources.GetObject("menuItem7.ShowShortcut")));
			this.menuItem7.Text = resources.GetString("menuItem7.Text");
			this.menuItem7.Visible = ((bool)(resources.GetObject("menuItem7.Visible")));
			// 
			// menuItemExit
			// 
			this.menuItemExit.Enabled = ((bool)(resources.GetObject("menuItemExit.Enabled")));
			this.menuItemExit.Index = 6;
			this.menuItemExit.Shortcut = ((System.Windows.Forms.Shortcut)(resources.GetObject("menuItemExit.Shortcut")));
			this.menuItemExit.ShowShortcut = ((bool)(resources.GetObject("menuItemExit.ShowShortcut")));
			this.menuItemExit.Text = resources.GetString("menuItemExit.Text");
			this.menuItemExit.Visible = ((bool)(resources.GetObject("menuItemExit.Visible")));
			this.menuItemExit.Click += new System.EventHandler(this.menuItemExit_Click);
			// 
			// menuItemEdit
			// 
			this.menuItemEdit.Enabled = ((bool)(resources.GetObject("menuItemEdit.Enabled")));
			this.menuItemEdit.Index = 1;
			this.menuItemEdit.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																						 this.menuItemUndo,
																						 this.menuItem10,
																						 this.menuItemCut,
																						 this.menuItemCopy,
																						 this.menuItemPaste,
																						 this.menuItemDel,
																						 this.menuItem15,
																						 this.menuItemAll,
																						 this.menuItemTime});
			this.menuItemEdit.Shortcut = ((System.Windows.Forms.Shortcut)(resources.GetObject("menuItemEdit.Shortcut")));
			this.menuItemEdit.ShowShortcut = ((bool)(resources.GetObject("menuItemEdit.ShowShortcut")));
			this.menuItemEdit.Text = resources.GetString("menuItemEdit.Text");
			this.menuItemEdit.Visible = ((bool)(resources.GetObject("menuItemEdit.Visible")));
			this.menuItemEdit.Popup += new System.EventHandler(this.menuItemEdit_Popup);
			// 
			// menuItemUndo
			// 
			this.menuItemUndo.Enabled = ((bool)(resources.GetObject("menuItemUndo.Enabled")));
			this.menuItemUndo.Index = 0;
			this.menuItemUndo.Shortcut = ((System.Windows.Forms.Shortcut)(resources.GetObject("menuItemUndo.Shortcut")));
			this.menuItemUndo.ShowShortcut = ((bool)(resources.GetObject("menuItemUndo.ShowShortcut")));
			this.menuItemUndo.Text = resources.GetString("menuItemUndo.Text");
			this.menuItemUndo.Visible = ((bool)(resources.GetObject("menuItemUndo.Visible")));
			this.menuItemUndo.Click += new System.EventHandler(this.menuItemUndo_Click);
			// 
			// menuItem10
			// 
			this.menuItem10.Enabled = ((bool)(resources.GetObject("menuItem10.Enabled")));
			this.menuItem10.Index = 1;
			this.menuItem10.Shortcut = ((System.Windows.Forms.Shortcut)(resources.GetObject("menuItem10.Shortcut")));
			this.menuItem10.ShowShortcut = ((bool)(resources.GetObject("menuItem10.ShowShortcut")));
			this.menuItem10.Text = resources.GetString("menuItem10.Text");
			this.menuItem10.Visible = ((bool)(resources.GetObject("menuItem10.Visible")));
			// 
			// menuItemCut
			// 
			this.menuItemCut.Enabled = ((bool)(resources.GetObject("menuItemCut.Enabled")));
			this.menuItemCut.Index = 2;
			this.menuItemCut.Shortcut = ((System.Windows.Forms.Shortcut)(resources.GetObject("menuItemCut.Shortcut")));
			this.menuItemCut.ShowShortcut = ((bool)(resources.GetObject("menuItemCut.ShowShortcut")));
			this.menuItemCut.Text = resources.GetString("menuItemCut.Text");
			this.menuItemCut.Visible = ((bool)(resources.GetObject("menuItemCut.Visible")));
			this.menuItemCut.Click += new System.EventHandler(this.menuItemCut_Click);
			// 
			// menuItemCopy
			// 
			this.menuItemCopy.Enabled = ((bool)(resources.GetObject("menuItemCopy.Enabled")));
			this.menuItemCopy.Index = 3;
			this.menuItemCopy.Shortcut = ((System.Windows.Forms.Shortcut)(resources.GetObject("menuItemCopy.Shortcut")));
			this.menuItemCopy.ShowShortcut = ((bool)(resources.GetObject("menuItemCopy.ShowShortcut")));
			this.menuItemCopy.Text = resources.GetString("menuItemCopy.Text");
			this.menuItemCopy.Visible = ((bool)(resources.GetObject("menuItemCopy.Visible")));
			this.menuItemCopy.Click += new System.EventHandler(this.menuItemCopy_Click);
			// 
			// menuItemPaste
			// 
			this.menuItemPaste.Enabled = ((bool)(resources.GetObject("menuItemPaste.Enabled")));
			this.menuItemPaste.Index = 4;
			this.menuItemPaste.Shortcut = ((System.Windows.Forms.Shortcut)(resources.GetObject("menuItemPaste.Shortcut")));
			this.menuItemPaste.ShowShortcut = ((bool)(resources.GetObject("menuItemPaste.ShowShortcut")));
			this.menuItemPaste.Text = resources.GetString("menuItemPaste.Text");
			this.menuItemPaste.Visible = ((bool)(resources.GetObject("menuItemPaste.Visible")));
			this.menuItemPaste.Click += new System.EventHandler(this.menuItemPaste_Click);
			// 
			// menuItemDel
			// 
			this.menuItemDel.Enabled = ((bool)(resources.GetObject("menuItemDel.Enabled")));
			this.menuItemDel.Index = 5;
			this.menuItemDel.Shortcut = ((System.Windows.Forms.Shortcut)(resources.GetObject("menuItemDel.Shortcut")));
			this.menuItemDel.ShowShortcut = ((bool)(resources.GetObject("menuItemDel.ShowShortcut")));
			this.menuItemDel.Text = resources.GetString("menuItemDel.Text");
			this.menuItemDel.Visible = ((bool)(resources.GetObject("menuItemDel.Visible")));
			this.menuItemDel.Click += new System.EventHandler(this.menuItemDel_Click);
			// 
			// menuItem15
			// 
			this.menuItem15.Enabled = ((bool)(resources.GetObject("menuItem15.Enabled")));
			this.menuItem15.Index = 6;
			this.menuItem15.Shortcut = ((System.Windows.Forms.Shortcut)(resources.GetObject("menuItem15.Shortcut")));
			this.menuItem15.ShowShortcut = ((bool)(resources.GetObject("menuItem15.ShowShortcut")));
			this.menuItem15.Text = resources.GetString("menuItem15.Text");
			this.menuItem15.Visible = ((bool)(resources.GetObject("menuItem15.Visible")));
			// 

⌨️ 快捷键说明

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