www.pudn.com > notepad.rar > Form1.cs


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 
{ 
 
	///  
	/// Form1 的摘要说明。 
	///  
	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; 
		///  
		/// 必需的设计器变量。 
		 
		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 System.ComponentModel.Container components = null; 
 
		public NotePad() 
		{ 
			// 
			// Windows 窗体设计器支持所必需的 
			// 
			InitializeComponent(); 
 
			// 
			// TODO: 在 InitializeComponent 调用后添加任何构造函数代码 
			// 
		} 
 
		///  
		/// 清理所有正在使用的资源。 
		///  
		protected override void Dispose( bool disposing ) 
		{ 
			if( disposing ) 
			{ 
				if (components != null)  
				{ 
					components.Dispose(); 
				} 
			} 
			base.Dispose( disposing ); 
		} 
 
		#region Windows 窗体设计器生成的代码 
		///  
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改 
		/// 此方法的内容。 
		///  
		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"))); 
			//  
			// menuItemAll 
			//  
			this.menuItemAll.Enabled = ((bool)(resources.GetObject("menuItemAll.Enabled"))); 
			this.menuItemAll.Index = 7; 
			this.menuItemAll.Shortcut = ((System.Windows.Forms.Shortcut)(resources.GetObject("menuItemAll.Shortcut"))); 
			this.menuItemAll.ShowShortcut = ((bool)(resources.GetObject("menuItemAll.ShowShortcut"))); 
			this.menuItemAll.Text = resources.GetString("menuItemAll.Text"); 
			this.menuItemAll.Visible = ((bool)(resources.GetObject("menuItemAll.Visible"))); 
			this.menuItemAll.Click += new System.EventHandler(this.menuItemAll_Click); 
			//  
			// menuItemTime 
			//  
			this.menuItemTime.Enabled = ((bool)(resources.GetObject("menuItemTime.Enabled"))); 
			this.menuItemTime.Index = 8; 
			this.menuItemTime.Shortcut = ((System.Windows.Forms.Shortcut)(resources.GetObject("menuItemTime.Shortcut"))); 
			this.menuItemTime.ShowShortcut = ((bool)(resources.GetObject("menuItemTime.ShowShortcut"))); 
			this.menuItemTime.Text = resources.GetString("menuItemTime.Text"); 
			this.menuItemTime.Visible = ((bool)(resources.GetObject("menuItemTime.Visible"))); 
			this.menuItemTime.Click += new System.EventHandler(this.menuItemTime_Click); 
			//  
			// menuItem2 
			//  
			this.menuItem2.Enabled = ((bool)(resources.GetObject("menuItem2.Enabled"))); 
			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}); 
			this.menuItem2.Shortcut = ((System.Windows.Forms.Shortcut)(resources.GetObject("menuItem2.Shortcut"))); 
			this.menuItem2.ShowShortcut = ((bool)(resources.GetObject("menuItem2.ShowShortcut"))); 
			this.menuItem2.Text = resources.GetString("menuItem2.Text"); 
			this.menuItem2.Visible = ((bool)(resources.GetObject("menuItem2.Visible"))); 
			//  
			// menuItemJingDian 
			//  
			this.menuItemJingDian.Enabled = ((bool)(resources.GetObject("menuItemJingDian.Enabled"))); 
			this.menuItemJingDian.Index = 1; 
			this.menuItemJingDian.Shortcut = ((System.Windows.Forms.Shortcut)(resources.GetObject("menuItemJingDian.Shortcut"))); 
			this.menuItemJingDian.ShowShortcut = ((bool)(resources.GetObject("menuItemJingDian.ShowShortcut"))); 
			this.menuItemJingDian.Text = resources.GetString("menuItemJingDian.Text"); 
			this.menuItemJingDian.Visible = ((bool)(resources.GetObject("menuItemJingDian.Visible"))); 
			this.menuItemJingDian.Click += new System.EventHandler(this.menuItemJingDian_Click); 
			//  
			// menuItemChunTian 
			//  
			this.menuItemChunTian.Checked = true; 
			this.menuItemChunTian.Enabled = ((bool)(resources.GetObject("menuItemChunTian.Enabled"))); 
			this.menuItemChunTian.Index = 0; 
			this.menuItemChunTian.Shortcut = ((System.Windows.Forms.Shortcut)(resources.GetObject("menuItemChunTian.Shortcut"))); 
			this.menuItemChunTian.ShowShortcut = ((bool)(resources.GetObject("menuItemChunTian.ShowShortcut"))); 
			this.menuItemChunTian.Text = resources.GetString("menuItemChunTian.Text"); 
			this.menuItemChunTian.Visible = ((bool)(resources.GetObject("menuItemChunTian.Visible"))); 
			this.menuItemChunTian.Click += new System.EventHandler(this.menuItemChunTian_Click); 
			//  
			// menuItemHejin 
			//  
			this.menuItemHejin.Enabled = ((bool)(resources.GetObject("menuItemHejin.Enabled"))); 
			this.menuItemHejin.Index = 2; 
			this.menuItemHejin.Shortcut = ((System.Windows.Forms.Shortcut)(resources.GetObject("menuItemHejin.Shortcut"))); 
			this.menuItemHejin.ShowShortcut = ((bool)(resources.GetObject("menuItemHejin.ShowShortcut"))); 
			this.menuItemHejin.Text = resources.GetString("menuItemHejin.Text"); 
			this.menuItemHejin.Visible = ((bool)(resources.GetObject("menuItemHejin.Visible"))); 
			this.menuItemHejin.Click += new System.EventHandler(this.menuItemHejin_Click); 
			//  
			// menuItem9 
			//  
			this.menuItem9.Enabled = ((bool)(resources.GetObject("menuItem9.Enabled"))); 
			this.menuItem9.Index = 3; 
			this.menuItem9.Shortcut = ((System.Windows.Forms.Shortcut)(resources.GetObject("menuItem9.Shortcut"))); 
			this.menuItem9.ShowShortcut = ((bool)(resources.GetObject("menuItem9.ShowShortcut"))); 
			this.menuItem9.Text = resources.GetString("menuItem9.Text"); 
			this.menuItem9.Visible = ((bool)(resources.GetObject("menuItem9.Visible"))); 
			//  
			// menuItemCancelSkin 
			//  
			this.menuItemCancelSkin.Enabled = ((bool)(resources.GetObject("menuItemCancelSkin.Enabled"))); 
			this.menuItemCancelSkin.Index = 4; 
			this.menuItemCancelSkin.Shortcut = ((System.Windows.Forms.Shortcut)(resources.GetObject("menuItemCancelSkin.Shortcut"))); 
			this.menuItemCancelSkin.ShowShortcut = ((bool)(resources.GetObject("menuItemCancelSkin.ShowShortcut"))); 
			this.menuItemCancelSkin.Text = resources.GetString("menuItemCancelSkin.Text"); 
			this.menuItemCancelSkin.Visible = ((bool)(resources.GetObject("menuItemCancelSkin.Visible"))); 
			this.menuItemCancelSkin.Click += new System.EventHandler(this.menuItemCancelSkin_Click); 
			//  
			// menuItemLoadSkin 
			//  
			this.menuItemLoadSkin.Enabled = ((bool)(resources.GetObject("menuItemLoadSkin.Enabled"))); 
			this.menuItemLoadSkin.Index = 5; 
			this.menuItemLoadSkin.Shortcut = ((System.Windows.Forms.Shortcut)(resources.GetObject("menuItemLoadSkin.Shortcut"))); 
			this.menuItemLoadSkin.ShowShortcut = ((bool)(resources.GetObject("menuItemLoadSkin.ShowShortcut"))); 
			this.menuItemLoadSkin.Text = resources.GetString("menuItemLoadSkin.Text"); 
			this.menuItemLoadSkin.Visible = ((bool)(resources.GetObject("menuItemLoadSkin.Visible"))); 
			this.menuItemLoadSkin.Click += new System.EventHandler(this.menuItemLoadSkin_Click); 
			//  
			// menuItemFormat 
			//  
			this.menuItemFormat.Enabled = ((bool)(resources.GetObject("menuItemFormat.Enabled"))); 
			this.menuItemFormat.Index = 3; 
			this.menuItemFormat.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { 
																						   this.menuItemReturn, 
																						   this.menuItem24, 
																						   this.menuItemFont, 
																						   this.menuItemBackcolor}); 
			this.menuItemFormat.Shortcut = ((System.Windows.Forms.Shortcut)(resources.GetObject("menuItemFormat.Shortcut"))); 
			this.menuItemFormat.ShowShortcut = ((bool)(resources.GetObject("menuItemFormat.ShowShortcut"))); 
			this.menuItemFormat.Text = resources.GetString("menuItemFormat.Text"); 
			this.menuItemFormat.Visible = ((bool)(resources.GetObject("menuItemFormat.Visible"))); 
			//  
			// menuItemReturn 
			//  
			this.menuItemReturn.Enabled = ((bool)(resources.GetObject("menuItemReturn.Enabled"))); 
			this.menuItemReturn.Index = 0; 
			this.menuItemReturn.RadioCheck = true; 
			this.menuItemReturn.Shortcut = ((System.Windows.Forms.Shortcut)(resources.GetObject("menuItemReturn.Shortcut"))); 
			this.menuItemReturn.ShowShortcut = ((bool)(resources.GetObject("menuItemReturn.ShowShortcut"))); 
			this.menuItemReturn.Text = resources.GetString("menuItemReturn.Text"); 
			this.menuItemReturn.Visible = ((bool)(resources.GetObject("menuItemReturn.Visible"))); 
			this.menuItemReturn.Click += new System.EventHandler(this.menuItemReturn_Click); 
			//  
			// menuItem24 
			//  
			this.menuItem24.Enabled = ((bool)(resources.GetObject("menuItem24.Enabled"))); 
			this.menuItem24.Index = 1; 
			this.menuItem24.Shortcut = ((System.Windows.Forms.Shortcut)(resources.GetObject("menuItem24.Shortcut"))); 
			this.menuItem24.ShowShortcut = ((bool)(resources.GetObject("menuItem24.ShowShortcut"))); 
			this.menuItem24.Text = resources.GetString("menuItem24.Text"); 
			this.menuItem24.Visible = ((bool)(resources.GetObject("menuItem24.Visible"))); 
			//  
			// menuItemFont 
			//  
			this.menuItemFont.Enabled = ((bool)(resources.GetObject("menuItemFont.Enabled"))); 
			this.menuItemFont.Index = 2; 
			this.menuItemFont.Shortcut = ((System.Windows.Forms.Shortcut)(resources.GetObject("menuItemFont.Shortcut"))); 
			this.menuItemFont.ShowShortcut = ((bool)(resources.GetObject("menuItemFont.ShowShortcut"))); 
			this.menuItemFont.Text = resources.GetString("menuItemFont.Text"); 
			this.menuItemFont.Visible = ((bool)(resources.GetObject("menuItemFont.Visible"))); 
			this.menuItemFont.Click += new System.EventHandler(this.menuItemFont_Click); 
			//  
			// menuItemBackcolor 
			//  
			this.menuItemBackcolor.Enabled = ((bool)(resources.GetObject("menuItemBackcolor.Enabled"))); 
			this.menuItemBackcolor.Index = 3; 
			this.menuItemBackcolor.Shortcut = ((System.Windows.Forms.Shortcut)(resources.GetObject("menuItemBackcolor.Shortcut"))); 
			this.menuItemBackcolor.ShowShortcut = ((bool)(resources.GetObject("menuItemBackcolor.ShowShortcut"))); 
			this.menuItemBackcolor.Text = resources.GetString("menuItemBackcolor.Text"); 
			this.menuItemBackcolor.Visible = ((bool)(resources.GetObject("menuItemBackcolor.Visible"))); 
			this.menuItemBackcolor.Click += new System.EventHandler(this.menuItemBackcolor_Click); 
			//  
			// menuItemHelp 
			//  
			this.menuItemHelp.Enabled = ((bool)(resources.GetObject("menuItemHelp.Enabled"))); 
			this.menuItemHelp.Index = 4; 
			this.menuItemHelp.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { 
																						 this.menuItemAbout}); 
			this.menuItemHelp.Shortcut = ((System.Windows.Forms.Shortcut)(resources.GetObject("menuItemHelp.Shortcut"))); 
			this.menuItemHelp.ShowShortcut = ((bool)(resources.GetObject("menuItemHelp.ShowShortcut"))); 
			this.menuItemHelp.Text = resources.GetString("menuItemHelp.Text"); 
			this.menuItemHelp.Visible = ((bool)(resources.GetObject("menuItemHelp.Visible"))); 
			//  
			// menuItemAbout 
			//  
			this.menuItemAbout.Enabled = ((bool)(resources.GetObject("menuItemAbout.Enabled"))); 
			this.menuItemAbout.Index = 0; 
			this.menuItemAbout.MdiList = true; 
			this.menuItemAbout.Shortcut = ((System.Windows.Forms.Shortcut)(resources.GetObject("menuItemAbout.Shortcut"))); 
			this.menuItemAbout.ShowShortcut = ((bool)(resources.GetObject("menuItemAbout.ShowShortcut"))); 
			this.menuItemAbout.Text = resources.GetString("menuItemAbout.Text"); 
			this.menuItemAbout.Visible = ((bool)(resources.GetObject("menuItemAbout.Visible"))); 
			this.menuItemAbout.Click += new System.EventHandler(this.menuItemAbout_Click); 
			//  
			// saveFileDialog1 
			//  
			this.saveFileDialog1.Filter = resources.GetString("saveFileDialog1.Filter"); 
			this.saveFileDialog1.InitialDirectory = "%USERPROFILE%"; 
			this.saveFileDialog1.RestoreDirectory = true; 
			this.saveFileDialog1.Title = resources.GetString("saveFileDialog1.Title"); 
			//  
			// fontDialog1 
			//  
			this.fontDialog1.FontMustExist = true; 
			this.fontDialog1.ShowColor = true; 
			//  
			// colorDialog1 
			//  
			this.colorDialog1.AnyColor = true; 
			//  
			// textBox 
			//  
			this.textBox.AcceptsReturn = true; 
			this.textBox.AccessibleDescription = resources.GetString("textBox.AccessibleDescription"); 
			this.textBox.AccessibleName = resources.GetString("textBox.AccessibleName"); 
			this.textBox.Anchor = ((System.Windows.Forms.AnchorStyles)(resources.GetObject("textBox.Anchor"))); 
			this.textBox.AutoSize = ((bool)(resources.GetObject("textBox.AutoSize"))); 
			this.textBox.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("textBox.BackgroundImage"))); 
			this.textBox.Dock = ((System.Windows.Forms.DockStyle)(resources.GetObject("textBox.Dock"))); 
			this.textBox.Enabled = ((bool)(resources.GetObject("textBox.Enabled"))); 
			this.textBox.Font = ((System.Drawing.Font)(resources.GetObject("textBox.Font"))); 
			this.textBox.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("textBox.ImeMode"))); 
			this.textBox.Location = ((System.Drawing.Point)(resources.GetObject("textBox.Location"))); 
			this.textBox.MaxLength = ((int)(resources.GetObject("textBox.MaxLength"))); 
			this.textBox.Multiline = ((bool)(resources.GetObject("textBox.Multiline"))); 
			this.textBox.Name = "textBox"; 
			this.textBox.PasswordChar = ((char)(resources.GetObject("textBox.PasswordChar"))); 
			this.textBox.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("textBox.RightToLeft"))); 
			this.textBox.ScrollBars = ((System.Windows.Forms.ScrollBars)(resources.GetObject("textBox.ScrollBars"))); 
			this.textBox.Size = ((System.Drawing.Size)(resources.GetObject("textBox.Size"))); 
			this.textBox.TabIndex = ((int)(resources.GetObject("textBox.TabIndex"))); 
			this.textBox.Text = resources.GetString("textBox.Text"); 
			this.textBox.TextAlign = ((System.Windows.Forms.HorizontalAlignment)(resources.GetObject("textBox.TextAlign"))); 
			this.textBox.Visible = ((bool)(resources.GetObject("textBox.Visible"))); 
			this.textBox.WordWrap = ((bool)(resources.GetObject("textBox.WordWrap"))); 
			this.textBox.TextChanged += new System.EventHandler(this.textBox_TextChanged); 
			//  
			// openFileDialog1 
			//  
			this.openFileDialog1.Filter = resources.GetString("openFileDialog1.Filter"); 
			this.openFileDialog1.RestoreDirectory = true; 
			this.openFileDialog1.Title = resources.GetString("openFileDialog1.Title"); 
			//  
			// NotePad 
			//  
			this.AccessibleDescription = resources.GetString("$this.AccessibleDescription"); 
			this.AccessibleName = resources.GetString("$this.AccessibleName"); 
			this.AutoScaleBaseSize = ((System.Drawing.Size)(resources.GetObject("$this.AutoScaleBaseSize"))); 
			this.AutoScroll = ((bool)(resources.GetObject("$this.AutoScroll"))); 
			this.AutoScrollMargin = ((System.Drawing.Size)(resources.GetObject("$this.AutoScrollMargin"))); 
			this.AutoScrollMinSize = ((System.Drawing.Size)(resources.GetObject("$this.AutoScrollMinSize"))); 
			this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage"))); 
			this.ClientSize = ((System.Drawing.Size)(resources.GetObject("$this.ClientSize"))); 
			this.Controls.Add(this.textBox); 
			this.Enabled = ((bool)(resources.GetObject("$this.Enabled"))); 
			this.Font = ((System.Drawing.Font)(resources.GetObject("$this.Font"))); 
			this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); 
			this.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("$this.ImeMode"))); 
			this.Location = ((System.Drawing.Point)(resources.GetObject("$this.Location"))); 
			this.MaximumSize = ((System.Drawing.Size)(resources.GetObject("$this.MaximumSize"))); 
			this.Menu = this.mainMenu; 
			this.MinimumSize = ((System.Drawing.Size)(resources.GetObject("$this.MinimumSize"))); 
			this.Name = "NotePad"; 
			this.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("$this.RightToLeft"))); 
			this.StartPosition = ((System.Windows.Forms.FormStartPosition)(resources.GetObject("$this.StartPosition"))); 
			this.Text = resources.GetString("$this.Text"); 
			this.Closing += new System.ComponentModel.CancelEventHandler(this.NotePad_Closing); 
			this.ResumeLayout(false); 
 
		} 
		#endregion 
 
		///  
		/// 应用程序的主入口点。 
		///  
		[STAThread] 
		static void Main()  
		{ 
 
			if (SkinStart(".\\skin\\spring.urf",4,"",1,0,0)==0) 
			{ 
				MessageBox.Show("找不到皮肤 -- \"春天\" "); 
				SkinStart(".\\skin\\belv.urf",4,"",1,0,0); 
		 
			} 
			 
			Application.Run(new NotePad()); 
 
			SkinRemove(); 
		} 
 
		 
		//新建 
		private void menuItemNew_Click(object sender, System.EventArgs e) 
		{ 
			if (needtosave==true) 
			{ 
				DialogResult result = MessageBox.Show(CurrentFileName+" 的内容已经改变,需要保存吗?","保存文件",MessageBoxButtons.YesNoCancel,MessageBoxIcon.Question); 
				switch(result) 
				{ 
					case DialogResult.OK: 
					{ 
						menuItemSave_Click(sender,e); 
						textBox.Clear(); 
						needtosave=false; 
						break; 
					} 
						 
					case DialogResult.No: 
					{ 
						textBox.Clear(); 
						this.Text = "文本编辑--新建文本"; 
						needtosave=false; 
						break; 
 
					 } 
						 
					case DialogResult.Cancel:	 
					{ 
 
						break; 
 
						 
					} 
				 
				} 
 
			} 
			else 
			{ 
				textBox.Clear(); 
				this.Text = "文本编辑--新建文本"; 
				needtosave=false; 
 
			} 
 
			 
		} 
 
		private void menuItemExit_Click(object sender, System.EventArgs e) 
		{ 
			Close(); 
 
		} 
 
		private void menuItemHelp_Click(object sender, System.EventArgs e) 
		{ 
		 
		} 
 
		private void menuItemOpen_Click(object sender, System.EventArgs e) 
		{ 
			try 
			{ 
				if (needtosave==true) 
				{ 
					DialogResult result = MessageBox.Show(CurrentFileName+" 的内容已经改变,需要保存吗?","保存文件",MessageBoxButtons.YesNoCancel,MessageBoxIcon.Question); 
					if (result==DialogResult.Cancel) 
					{ 
						return; 
					} 
					if (result==DialogResult.OK) 
					{ 
						menuItemSave_Click(sender,e); 
						needtosave=false; 
 
					} 
 
				} 
 
				openFileDialog1.InitialDirectory = "%USERPROFILE%"; 
 
				if(openFileDialog1.ShowDialog() == DialogResult.OK ) 
				{ 
					StreamReader sr = new StreamReader(openFileDialog1.FileName,Encoding.Default); 
					textBox.Text = sr.ReadToEnd(); 
					sr.Close(); 
					CurrentFileName = openFileDialog1.FileName; 
 
					this.Text = "文本编辑--"+CurrentFileName; 
					needtosave=false; 
				} 
 
			 
			} 
			catch(Exception err) 
			{ 
				MessageBox.Show(err.Message.ToString()); 
 
			} 
 
			 
		} 
		 
		private void menuItemSave_Click(object sender, System.EventArgs e) 
		{ 
			try 
			{ 
 
			    saveFileDialog1.Title = "保存"; 
				if(saveFileDialog1.ShowDialog() == DialogResult.OK ) 
				{ 
			 
					if (saveFileDialog1.FileName != null) 
					{										 
						StreamWriter sw = new StreamWriter(saveFileDialog1.FileName); 
						sw.Write(textBox.Text); 
						sw.Close(); 
 
					} 
				} 
			} 
			catch(Exception err) 
			{ 
				MessageBox.Show(err.Message.ToString()); 
 
 
			} 
		} 
 
		private void menuItemSaveAs_Click(object sender, System.EventArgs e) 
		{ 
			saveFileDialog1.Title = "另存为"; 
			if (saveFileDialog1.ShowDialog() == DialogResult.OK) 
			{ 
				StreamWriter asw = new StreamWriter(saveFileDialog1.FileName,true); 
				asw.Write(textBox.Text); 
				asw.Close(); 
 
 
			} 
		} 
 
 
		private void menuItemUndo_Click(object sender, System.EventArgs e) 
		{ 
			if (textBox.CanUndo == true) 
			{ 
				textBox.Undo(); 
				textBox.ClearUndo(); 
				 
 
			} 
			 
		} 
 
		private void menuItemCut_Click(object sender, System.EventArgs e) 
		{ 
			if (textBox.SelectedText != "") 
			{ 
				textBox.Cut(); 
 
			} 
			 
		} 
 
		private void menuItemCopy_Click(object sender, System.EventArgs e) 
		{ 
			textBox.Copy(); 
 
		} 
 
		private void menuItemPaste_Click(object sender, System.EventArgs e) 
		{ 
			if (Clipboard.GetDataObject().GetDataPresent(DataFormats.Text) == true) 
			{ 
				textBox.Paste(); 
 
			} 
			 
		} 
 
		private void menuItemDel_Click(object sender, System.EventArgs e) 
		{ 
			if (textBox.SelectedText != "") 
			{ 
				textBox.SelectedText = ""; 
 
			} 
			 
		} 
 
		private void menuItemAll_Click(object sender, System.EventArgs e) 
		{ 
			textBox.SelectAll(); 
		} 
 
					 
 
		private void menuItemAbout_Click(object sender, System.EventArgs e) 
		{ 
			About aboutform = new About(); 
			aboutform.ShowDialog(); 
		} 
		 
		bool flag; 
 
		private void menuItemReturn_Click(object sender, System.EventArgs e) 
		{ 
			 
			switch (flag) 
			{ 
				case true : 
					flag = false; 
					menuItemReturn.Checked = false; 
					textBox.WordWrap = false; 
					break; 
				case false: 
					flag = true; 
					menuItemReturn.Checked = true; 
					textBox.WordWrap = true; 
					break; 
 
			} 
		 
		} 
 
		private void menuItemFont_Click(object sender, System.EventArgs e) 
		{ 
			if(fontDialog1.ShowDialog() == DialogResult.OK ) 
			{ 
				textBox.Font = fontDialog1.Font; 
				textBox.ForeColor = fontDialog1.Color; 
 
			} 
		} 
 
		private void menuItemBackcolor_Click(object sender, System.EventArgs e) 
		{ 
			if(colorDialog1.ShowDialog() == DialogResult.OK ) 
			{ 
				textBox.BackColor = colorDialog1.Color; 
 
			} 
		} 
 
		private void menuItemTime_Click(object sender, System.EventArgs e) 
		{ 
 
 
		} 
 
		////////////////////////////////////////////////////////////////////////// 
		 
 
		///实现动态控制菜单 
 
		private void menuItemEdit_Popup(object sender, System.EventArgs e) 
		{ 
			//根据剪贴板所否有内容 而确定 menueItemPaste所否可用 
			if (Clipboard.GetDataObject().GetDataPresent(DataFormats.Text)) 
			{ 
				menuItemPaste.Enabled = true; 
 
			} 
			else 
			{ 
				menuItemPaste.Enabled = false; 
 
			} 
 
			//决定menuItemCut,menuItemCopy,menuItemDel是否可用 
 
			if (textBox.SelectedText.Length>0) 
			{ 
				menuItemCopy.Enabled= true; 
				menuItemCut.Enabled = true; 
				menuItemDel.Enabled = true; 
 
			} 
			else 
			{ 
				menuItemCopy.Enabled = false; 
				menuItemCut.Enabled = false; 
				menuItemDel.Enabled = false; 
 
			} 
			//决定menuItemUndo是否可用 
			 
			if (textBox.CanUndo == true) 
			{ 
				menuItemUndo.Enabled = true; 
			} 
			else 
			{ 
				menuItemUndo.Enabled = false; 
 
			} 
 
	 
		} 
 
		private void textBox_TextChanged(object sender, System.EventArgs e) 
		{ 
			needtosave = true; 
		} 
 
		private void NotePad_Closing(object sender, System.ComponentModel.CancelEventArgs e) 
		{ 
			if (needtosave==true) 
			{ 
				DialogResult result = MessageBox.Show(CurrentFileName+" 的内容已经改变。\n想保存文件吗?","保存",MessageBoxButtons.YesNoCancel,MessageBoxIcon.Question); 
 
				if(result == DialogResult.Cancel) 
				{ 
					e.Cancel=true; 
					return; 
                 
				} 
				if (result == DialogResult.Yes) 
				{ 
					menuItemSave_Click(sender,e); 
					e.Cancel=false; 
					return; 
				} 
 
			} 
			 
			 
 
		} 
 
		private void DoSkin(string SkinFile) 
		{			 
			SkinStart(".\\skin\\"+SkinFile,4,"",1,0,0); 
		} 
 
		private void CancelCheked() 
		{ 
			menuItemJingDian.Checked = false; 
			menuItemChunTian.Checked = false; 
			menuItemHejin.Checked = false; 
			menuItemCancelSkin.Checked = false; 
 
		} 
		private void menuItemJingDian_Click(object sender, System.EventArgs e) 
		{ 
			DoSkin("GtClassic.urf"); 
			CancelCheked(); 
			menuItemJingDian.Checked = true; 
 
		} 
 
		private void menuItemChunTian_Click(object sender, System.EventArgs e) 
		{ 
			DoSkin("spring.urf"); 
			CancelCheked(); 
			menuItemChunTian.Checked = true; 
 
 
		} 
 
		private void menuItemHejin_Click(object sender, System.EventArgs e) 
		{ 
			DoSkin("alloy.urf"); 
			CancelCheked(); 
			menuItemHejin.Checked = true; 
 
		 
		} 
 
		private void menuItemLoadSkin_Click(object sender, System.EventArgs e) 
		{ 
			 
			openFileDialog1.Filter = "*.urf|*.urf"; 
			openFileDialog1.Title = "打开皮肤"; 
			openFileDialog1.InitialDirectory = ".\\Skin\\"; 
			if (openFileDialog1.ShowDialog() == DialogResult.OK) 
			{ 
				SkinStart(openFileDialog1.FileName,4,"",1,0,0); 
			} 
		} 
 
		private void menuItemCancelSkin_Click(object sender, System.EventArgs e) 
		{ 
			DoSkin(""); 
			CancelCheked(); 
			menuItemCancelSkin.Checked = true; 
 
		} 
 
	 
		 
	 
	 
	} 
 
	 
	 
}