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

📄 form1.cs

📁 windows的记事本
💻 CS
📖 第 1 页 / 共 2 页
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Drawing;
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;
        private IContainer components;

		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()
		{
            this.components = new System.ComponentModel.Container();
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(NotePad));
            this.mainMenu = new System.Windows.Forms.MainMenu(this.components);
            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.menuItemChunTian = new System.Windows.Forms.MenuItem();
            this.menuItemJingDian = 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});
            // 
            // menuItemFile
            // 
            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});
            resources.ApplyResources(this.menuItemFile, "menuItemFile");
            // 
            // menuItemNew
            // 
            this.menuItemNew.Index = 0;
            resources.ApplyResources(this.menuItemNew, "menuItemNew");
            this.menuItemNew.Click += new System.EventHandler(this.menuItemNew_Click);
            // 
            // menuItem1
            // 
            this.menuItem1.Index = 1;
            resources.ApplyResources(this.menuItem1, "menuItem1");
            // 
            // menuItemOpen
            // 
            this.menuItemOpen.Index = 2;
            resources.ApplyResources(this.menuItemOpen, "menuItemOpen");
            this.menuItemOpen.Click += new System.EventHandler(this.menuItemOpen_Click);
            // 
            // menuItemSave
            // 
            this.menuItemSave.Index = 3;
            resources.ApplyResources(this.menuItemSave, "menuItemSave");
            this.menuItemSave.Click += new System.EventHandler(this.menuItemSave_Click);
            // 
            // menuItemSaveAs
            // 
            this.menuItemSaveAs.Index = 4;
            resources.ApplyResources(this.menuItemSaveAs, "menuItemSaveAs");
            this.menuItemSaveAs.Click += new System.EventHandler(this.menuItemSaveAs_Click);
            // 
            // menuItem7
            // 
            this.menuItem7.Index = 5;
            resources.ApplyResources(this.menuItem7, "menuItem7");
            // 
            // menuItemExit
            // 
            this.menuItemExit.Index = 6;
            resources.ApplyResources(this.menuItemExit, "menuItemExit");
            this.menuItemExit.Click += new System.EventHandler(this.menuItemExit_Click);
            // 
            // menuItemEdit
            // 
            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});
            resources.ApplyResources(this.menuItemEdit, "menuItemEdit");
            this.menuItemEdit.Popup += new System.EventHandler(this.menuItemEdit_Popup);
            // 
            // menuItemUndo
            // 
            this.menuItemUndo.Index = 0;
            resources.ApplyResources(this.menuItemUndo, "menuItemUndo");
            this.menuItemUndo.Click += new System.EventHandler(this.menuItemUndo_Click);
            // 
            // menuItem10
            // 
            this.menuItem10.Index = 1;
            resources.ApplyResources(this.menuItem10, "menuItem10");
            // 
            // menuItemCut
            // 
            this.menuItemCut.Index = 2;
            resources.ApplyResources(this.menuItemCut, "menuItemCut");
            this.menuItemCut.Click += new System.EventHandler(this.menuItemCut_Click);
            // 
            // menuItemCopy
            // 
            this.menuItemCopy.Index = 3;
            resources.ApplyResources(this.menuItemCopy, "menuItemCopy");
            this.menuItemCopy.Click += new System.EventHandler(this.menuItemCopy_Click);
            // 
            // menuItemPaste
            // 
            this.menuItemPaste.Index = 4;
            resources.ApplyResources(this.menuItemPaste, "menuItemPaste");
            this.menuItemPaste.Click += new System.EventHandler(this.menuItemPaste_Click);
            // 
            // menuItemDel
            // 
            this.menuItemDel.Index = 5;
            resources.ApplyResources(this.menuItemDel, "menuItemDel");
            this.menuItemDel.Click += new System.EventHandler(this.menuItemDel_Click);
            // 
            // menuItem15
            // 
            this.menuItem15.Index = 6;
            resources.ApplyResources(this.menuItem15, "menuItem15");
            // 
            // menuItemAll
            // 
            this.menuItemAll.Index = 7;
            resources.ApplyResources(this.menuItemAll, "menuItemAll");
            this.menuItemAll.Click += new System.EventHandler(this.menuItemAll_Click);
            // 
            // menuItemTime
            // 
            this.menuItemTime.Index = 8;
            resources.ApplyResources(this.menuItemTime, "menuItemTime");
            this.menuItemTime.Click += new System.EventHandler(this.menuItemTime_Click);
            // 
            // menuItem2
            // 
            this.menuItem2.Index = 2;
            this.menuItem2.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
            this.menuItemChunTian,
            this.menuItemJingDian,
            this.menuItemHejin,
            this.menuItem9,
            this.menuItemCancelSkin,
            this.menuItemLoadSkin});
            resources.ApplyResources(this.menuItem2, "menuItem2");
            // 
            // menuItemChunTian
            // 
            this.menuItemChunTian.Checked = true;
            this.menuItemChunTian.Index = 0;
            resources.ApplyResources(this.menuItemChunTian, "menuItemChunTian");
            this.menuItemChunTian.Click += new System.EventHandler(this.menuItemChunTian_Click);
            // 
            // menuItemJingDian
            // 
            this.menuItemJingDian.Index = 1;
            resources.ApplyResources(this.menuItemJingDian, "menuItemJingDian");
            this.menuItemJingDian.Click += new System.EventHandler(this.menuItemJingDian_Click);
            // 
            // menuItemHejin
            // 
            this.menuItemHejin.Index = 2;
            resources.ApplyResources(this.menuItemHejin, "menuItemHejin");
            this.menuItemHejin.Click += new System.EventHandler(this.menuItemHejin_Click);
            // 
            // menuItem9
            // 
            this.menuItem9.Index = 3;
            resources.ApplyResources(this.menuItem9, "menuItem9");
            // 
            // menuItemCancelSkin
            // 
            this.menuItemCancelSkin.Index = 4;
            resources.ApplyResources(this.menuItemCancelSkin, "menuItemCancelSkin");
            this.menuItemCancelSkin.Click += new System.EventHandler(this.menuItemCancelSkin_Click);
            // 
            // menuItemLoadSkin
            // 
            resources.ApplyResources(this.menuItemLoadSkin, "menuItemLoadSkin");
            this.menuItemLoadSkin.Index = 5;
            this.menuItemLoadSkin.Click += new System.EventHandler(this.menuItemLoadSkin_Click);
            // 
            // menuItemFormat
            // 
            this.menuItemFormat.Index = 3;
            this.menuItemFormat.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
            this.menuItemReturn,
            this.menuItem24,
            this.menuItemFont,
            this.menuItemBackcolor});
            resources.ApplyResources(this.menuItemFormat, "menuItemFormat");
            // 
            // menuItemReturn
            // 
            this.menuItemReturn.Index = 0;
            this.menuItemReturn.RadioCheck = true;
            resources.ApplyResources(this.menuItemReturn, "menuItemReturn");
            this.menuItemReturn.Click += new System.EventHandler(this.menuItemReturn_Click);
            // 
            // menuItem24
            // 
            this.menuItem24.Index = 1;
            resources.ApplyResources(this.menuItem24, "menuItem24");
            // 
            // menuItemFont
            // 
            this.menuItemFont.Index = 2;
            resources.ApplyResources(this.menuItemFont, "menuItemFont");
            this.menuItemFont.Click += new System.EventHandler(this.menuItemFont_Click);
            // 
            // menuItemBackcolor
            // 
            this.menuItemBackcolor.Index = 3;
            resources.ApplyResources(this.menuItemBackcolor, "menuItemBackcolor");
            this.menuItemBackcolor.Click += new System.EventHandler(this.menuItemBackcolor_Click);
            // 
            // menuItemHelp
            // 
            this.menuItemHelp.Index = 4;
            this.menuItemHelp.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
            this.menuItemAbout});
            resources.ApplyResources(this.menuItemHelp, "menuItemHelp");
            // 
            // menuItemAbout
            // 
            this.menuItemAbout.Index = 0;
            this.menuItemAbout.MdiList = true;
            resources.ApplyResources(this.menuItemAbout, "menuItemAbout");
            this.menuItemAbout.Click += new System.EventHandler(this.menuItemAbout_Click);
            // 
            // saveFileDialog1
            // 
            resources.ApplyResources(this.saveFileDialog1, "saveFileDialog1");
            this.saveFileDialog1.InitialDirectory = "%USERPROFILE%";
            this.saveFileDialog1.RestoreDirectory = true;
            // 
            // fontDialog1
            // 
            this.fontDialog1.FontMustExist = true;
            this.fontDialog1.ShowColor = true;
            // 
            // colorDialog1
            // 
            this.colorDialog1.AnyColor = true;
            // 
            // textBox
            // 
            this.textBox.AcceptsReturn = true;
            resources.ApplyResources(this.textBox, "textBox");
            this.textBox.Name = "textBox";
            this.textBox.TextChanged += new System.EventHandler(this.textBox_TextChanged);
            // 
            // openFileDialog1
            // 
            resources.ApplyResources(this.openFileDialog1, "openFileDialog1");
            this.openFileDialog1.RestoreDirectory = true;
            // 
            // NotePad
            // 
            resources.ApplyResources(this, "$this");
            this.Controls.Add(this.textBox);
            this.Menu = this.mainMenu;
            this.Name = "NotePad";
            this.Closing += new System.ComponentModel.CancelEventHandler(this.NotePad_Closing);
            this.ResumeLayout(false);
            this.PerformLayout();

		}
		#endregion

⌨️ 快捷键说明

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