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

📄 mainform.cs

📁 自己写的多窗口文本编辑器
💻 CS
📖 第 1 页 / 共 3 页
字号:
               this.miHelp.MergeOrder = 5;
               this.miHelp.Click += new System.EventHandler(this.miHelp_Click);
               // 
               // miH
               // 
               resources.ApplyResources(this.miH, "miH");
               this.miH.Index = 0;
               this.miH.Click += new System.EventHandler(this.miH_Click);
               // 
               // miMake
               // 
               resources.ApplyResources(this.miMake, "miMake");
               this.miMake.Index = 1;
               this.miMake.Click += new System.EventHandler(this.miMake_Click);
               // 
               // miLanguage
               // 
               resources.ApplyResources(this.miLanguage, "miLanguage");
               this.miLanguage.Index = 3;
               this.miLanguage.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
            this.miSimpleChinese,
            this.miEnglish});
               this.miLanguage.MergeOrder = 4;
               // 
               // miSimpleChinese
               // 
               resources.ApplyResources(this.miSimpleChinese, "miSimpleChinese");
               this.miSimpleChinese.Index = 0;
               this.miSimpleChinese.Click += new System.EventHandler(this.miSimpleChinese_Click);
               // 
               // miEnglish
               // 
               resources.ApplyResources(this.miEnglish, "miEnglish");
               this.miEnglish.Index = 1;
               this.miEnglish.Click += new System.EventHandler(this.miEnglish_Click);
               // 
               // openFileDialog
               // 
               resources.ApplyResources(this.openFileDialog, "openFileDialog");
               // 
               // statusBar1
               // 
               this.statusBar1.AccessibleDescription = null;
               this.statusBar1.AccessibleName = null;
               resources.ApplyResources(this.statusBar1, "statusBar1");
               this.statusBar1.BackgroundImage = null;
               this.statusBar1.Font = null;
               this.statusBar1.Name = "statusBar1";
               this.statusBar1.Panels.AddRange(new System.Windows.Forms.StatusBarPanel[] {
            this.statusBarPanel1,
            this.statusBarPanel2,
            this.statusBarPanel3});
               this.statusBar1.ShowPanels = true;
               // 
               // statusBarPanel1
               // 
               resources.ApplyResources(this.statusBarPanel1, "statusBarPanel1");
               this.statusBarPanel1.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Spring;
               this.statusBarPanel1.Icon = null;
               // 
               // statusBarPanel2
               // 
               resources.ApplyResources(this.statusBarPanel2, "statusBarPanel2");
               this.statusBarPanel2.Icon = null;
               // 
               // statusBarPanel3
               // 
               resources.ApplyResources(this.statusBarPanel3, "statusBarPanel3");
               this.statusBarPanel3.Icon = null;
               // 
               // toolBar
               // 
               this.toolBar.AccessibleDescription = null;
               this.toolBar.AccessibleName = null;
               resources.ApplyResources(this.toolBar, "toolBar");
               this.toolBar.BackgroundImage = null;
               this.toolBar.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[] {
            this.tbnNew,
            this.tbnOpen,
            this.tbnSave,
            this.tbnSeparator});
               this.toolBar.Font = null;
               this.toolBar.ImageList = this.imageList1;
               this.toolBar.Name = "toolBar";
               this.toolBar.Tag = "0";
               this.toolBar.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.toolBar_ButtonClick);
               // 
               // tbnNew
               // 
               resources.ApplyResources(this.tbnNew, "tbnNew");
               this.tbnNew.Name = "tbnNew";
               this.tbnNew.Tag = "tbnNew";
               // 
               // tbnOpen
               // 
               resources.ApplyResources(this.tbnOpen, "tbnOpen");
               this.tbnOpen.Name = "tbnOpen";
               this.tbnOpen.Tag = "tbnOpen";
               // 
               // tbnSave
               // 
               resources.ApplyResources(this.tbnSave, "tbnSave");
               this.tbnSave.Name = "tbnSave";
               this.tbnSave.Tag = "tbnSave";
               // 
               // tbnSeparator
               // 
               resources.ApplyResources(this.tbnSeparator, "tbnSeparator");
               this.tbnSeparator.Name = "tbnSeparator";
               this.tbnSeparator.Style = System.Windows.Forms.ToolBarButtonStyle.Separator;
               this.tbnSeparator.Tag = "tbnSeparator";
               // 
               // imageList1
               // 
               this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream")));
               this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
               this.imageList1.Images.SetKeyName(0, "");
               this.imageList1.Images.SetKeyName(1, "");
               this.imageList1.Images.SetKeyName(2, "");
               this.imageList1.Images.SetKeyName(3, "");
               this.imageList1.Images.SetKeyName(4, "");
               this.imageList1.Images.SetKeyName(5, "");
               this.imageList1.Images.SetKeyName(6, "");
               this.imageList1.Images.SetKeyName(7, "");
               this.imageList1.Images.SetKeyName(8, "");
               // 
               // contextMenu1
               // 
               this.contextMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
            this.conNew,
            this.conOpen,
            this.conExit,
            this.conSave,
            this.conCascade,
            this.conTileHorizontal});
               resources.ApplyResources(this.contextMenu1, "contextMenu1");
               // 
               // conNew
               // 
               resources.ApplyResources(this.conNew, "conNew");
               this.conNew.Index = 0;
               this.conNew.Click += new System.EventHandler(this.miNew_Click);
               // 
               // conOpen
               // 
               resources.ApplyResources(this.conOpen, "conOpen");
               this.conOpen.Index = 1;
               this.conOpen.Click += new System.EventHandler(this.miOpen_Click);
               // 
               // conExit
               // 
               resources.ApplyResources(this.conExit, "conExit");
               this.conExit.Index = 2;
               this.conExit.Click += new System.EventHandler(this.miExit_Click);
               // 
               // conSave
               // 
               resources.ApplyResources(this.conSave, "conSave");
               this.conSave.Index = 3;
               this.conSave.Click += new System.EventHandler(this.miSave_Click);
               // 
               // conCascade
               // 
               resources.ApplyResources(this.conCascade, "conCascade");
               this.conCascade.Index = 4;
               this.conCascade.Click += new System.EventHandler(this.conCascade_Click);
               // 
               // conTileHorizontal
               // 
               resources.ApplyResources(this.conTileHorizontal, "conTileHorizontal");
               this.conTileHorizontal.Index = 5;
               this.conTileHorizontal.Click += new System.EventHandler(this.conTileHorizontal_Click);
               // 
               // saveFileDialog1
               // 
               resources.ApplyResources(this.saveFileDialog1, "saveFileDialog1");
               // 
               // timer
               // 
               this.timer.Enabled = true;
               this.timer.Tick += new System.EventHandler(this.timer_Tick);
               // 
               // MainForm
               // 
               this.AccessibleDescription = null;
               this.AccessibleName = null;
               resources.ApplyResources(this, "$this");
               this.BackgroundImage = null;
               this.ContextMenu = this.contextMenu1;
               this.Controls.Add(this.toolBar);
               this.Controls.Add(this.statusBar1);
               this.Font = null;
               this.IsMdiContainer = true;
               this.Menu = this.mainMenu1;
               this.Name = "MainForm";
               this.Load += new System.EventHandler(this.MainForm_Load);
               this.MdiChildActivate += new System.EventHandler(this.MainForm_MdiChildActivate);
               ((System.ComponentModel.ISupportInitialize)(this.statusBarPanel1)).EndInit();
               ((System.ComponentModel.ISupportInitialize)(this.statusBarPanel2)).EndInit();
               ((System.ComponentModel.ISupportInitialize)(this.statusBarPanel3)).EndInit();
               this.ResumeLayout(false);
               this.PerformLayout();

		}
		#endregion

		/// <summary>
		/// 应用程序的主入口点。
		/// </summary>
		[STAThread]
			//
		static void Main(string[] args) 
		{
			Application.Run(new MainForm());
		}

		private void miOpen_Click(object sender, System.EventArgs e)
		{
			if(openFileDialog.ShowDialog()==DialogResult.OK )
			{
				Form2 f2=new Form2(openFileDialog.FileName );
			   
				f2.MdiParent =this;
				f2.posChanged += new PosChangedHandler(f2_posChanged);
				f2_posChanged(new Point(1,1));
				f2.Show ();
			}
		}
        int newCount=0;
		private void miNew_Click(object sender, System.EventArgs e)
		{
			newCount++; 
			Form2 f2=new Form2(newCount);
			f2.MdiParent =this;
			f2.posChanged += new PosChangedHandler(f2_posChanged);
			f2_posChanged(new Point(1,1));
			f2.Show ();
	
		}

	


		private void miExit_Click(object sender, System.EventArgs e)
		{
			Close();
		}
		private void f2_posChanged(Point CaretPos)
		{
			statusBar1.Panels[1].Text = "第 "+CaretPos.Y.ToString()+" 行,第 "+CaretPos.X.ToString()+"列";
		}
		

		private void menuItem7_Click(object sender, System.EventArgs e)
		{
			OptionsForm o =new OptionsForm ();
			if(o.ShowDialog()==DialogResult.OK )
			{
			}
			else
			{
			}
		}

		private void toolBar_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
		{
			switch(e.Button.Tag.ToString())
			{
				case "tbnNew":miNew_Click(null,null);
					break;
				case "tbnOpen":miOpen_Click(null,null);
					break;
				case "tbnSave":miSave_Click(null,null);
					break;

			}
				
		}

		private void miFile_Popup(object sender, System.EventArgs e)
		{
			miSave.Enabled=this.MdiChildren.Length >0;
			miSaveAs.Enabled=miSave.Enabled;
		}

		private void miRelation_Click(object sender, System.EventArgs e)

⌨️ 快捷键说明

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