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

📄 csharpviewer.cs

📁 C#编写的c#编译器
💻 CS
📖 第 1 页 / 共 2 页
字号:
			this.richTextBoxSource.Font = new System.Drawing.Font("Courier New", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.richTextBoxSource.HideSelection = false;
			this.richTextBoxSource.Name = "richTextBoxSource";
			this.richTextBoxSource.Size = new System.Drawing.Size(792, 703);
			this.richTextBoxSource.TabIndex = 3;
			this.richTextBoxSource.Text = "Source";
			this.richTextBoxSource.WordWrap = false;
			this.richTextBoxSource.TextChanged += new System.EventHandler(this.richTextBoxSource_TextChanged);
			// 
			// tabPageAntlrTree
			// 
			this.tabPageAntlrTree.Controls.AddRange(new System.Windows.Forms.Control[] {
																						   this.richTextBoxAntlrTree});
			this.tabPageAntlrTree.Location = new System.Drawing.Point(4, 22);
			this.tabPageAntlrTree.Name = "tabPageAntlrTree";
			this.tabPageAntlrTree.Size = new System.Drawing.Size(792, 703);
			this.tabPageAntlrTree.TabIndex = 1;
			this.tabPageAntlrTree.Text = "Antlr Tree";
			// 
			// tabPageCSharpDom
			// 
			this.tabPageCSharpDom.Controls.AddRange(new System.Windows.Forms.Control[] {
																						   this.richTextBoxCSharpDom});
			this.tabPageCSharpDom.Location = new System.Drawing.Point(4, 22);
			this.tabPageCSharpDom.Name = "tabPageCSharpDom";
			this.tabPageCSharpDom.Size = new System.Drawing.Size(792, 703);
			this.tabPageCSharpDom.TabIndex = 2;
			this.tabPageCSharpDom.Text = "CSharp Dom";
			// 
			// richTextBoxCSharpDom
			// 
			this.richTextBoxCSharpDom.Dock = System.Windows.Forms.DockStyle.Fill;
			this.richTextBoxCSharpDom.Font = new System.Drawing.Font("Courier New", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.richTextBoxCSharpDom.Name = "richTextBoxCSharpDom";
			this.richTextBoxCSharpDom.Size = new System.Drawing.Size(792, 703);
			this.richTextBoxCSharpDom.TabIndex = 4;
			this.richTextBoxCSharpDom.Text = "CSharp Dom";
			this.richTextBoxCSharpDom.WordWrap = false;
			// 
			// tabPageRegen
			// 
			this.tabPageRegen.Controls.AddRange(new System.Windows.Forms.Control[] {
																					   this.richTextBoxRegen});
			this.tabPageRegen.Location = new System.Drawing.Point(4, 22);
			this.tabPageRegen.Name = "tabPageRegen";
			this.tabPageRegen.Size = new System.Drawing.Size(792, 703);
			this.tabPageRegen.TabIndex = 3;
			this.tabPageRegen.Text = "Regenerated Code";
			// 
			// richTextBoxRegen
			// 
			this.richTextBoxRegen.Dock = System.Windows.Forms.DockStyle.Fill;
			this.richTextBoxRegen.Font = new System.Drawing.Font("Courier New", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.richTextBoxRegen.HideSelection = false;
			this.richTextBoxRegen.Name = "richTextBoxRegen";
			this.richTextBoxRegen.Size = new System.Drawing.Size(792, 703);
			this.richTextBoxRegen.TabIndex = 5;
			this.richTextBoxRegen.Text = "Regenerated Code";
			this.richTextBoxRegen.WordWrap = false;
			// 
			// tabStats
			// 
			this.tabStats.Controls.AddRange(new System.Windows.Forms.Control[] {
																				   this.richTextBoxStats});
			this.tabStats.Location = new System.Drawing.Point(4, 22);
			this.tabStats.Name = "tabStats";
			this.tabStats.Size = new System.Drawing.Size(792, 703);
			this.tabStats.TabIndex = 4;
			this.tabStats.Text = "Stats";
			// 
			// richTextBoxStats
			// 
			this.richTextBoxStats.Dock = System.Windows.Forms.DockStyle.Fill;
			this.richTextBoxStats.Name = "richTextBoxStats";
			this.richTextBoxStats.Size = new System.Drawing.Size(792, 703);
			this.richTextBoxStats.TabIndex = 0;
			this.richTextBoxStats.Text = "Stats";
			// 
			// splitter1
			// 
			this.splitter1.Location = new System.Drawing.Point(392, 0);
			this.splitter1.Name = "splitter1";
			this.splitter1.Size = new System.Drawing.Size(8, 729);
			this.splitter1.TabIndex = 3;
			this.splitter1.TabStop = false;
			// 
			// mainMenu1
			// 
			this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																					  this.menuItem1,
																					  this.menuItem2,
																					  this.menuItem3,
																					  this.menuItem4});
			// 
			// menuItem1
			// 
			this.menuItem1.Index = 0;
			this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																					  this.menuItem5});
			this.menuItem1.Text = "&File";
			// 
			// menuItem5
			// 
			this.menuItem5.Index = 0;
			this.menuItem5.Text = "&Open";
			this.menuItem5.Click += new System.EventHandler(this.menuItem5_Click);
			// 
			// menuItem2
			// 
			this.menuItem2.Index = 1;
			this.menuItem2.Text = "&Edit";
			// 
			// menuItem3
			// 
			this.menuItem3.Index = 2;
			this.menuItem3.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																					  this.menuItem6,
																					  this.menuItem7});
			this.menuItem3.Text = "&View";
			// 
			// menuItem6
			// 
			this.menuItem6.Index = 0;
			this.menuItem6.Text = "Expand All";
			this.menuItem6.Click += new System.EventHandler(this.menuItem6_Click);
			// 
			// menuItem7
			// 
			this.menuItem7.Index = 1;
			this.menuItem7.Text = "Collapse All";
			this.menuItem7.Click += new System.EventHandler(this.menuItem7_Click);
			// 
			// menuItem4
			// 
			this.menuItem4.Index = 3;
			this.menuItem4.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																					  this.menuItem8});
			this.menuItem4.Text = "&Help";
			// 
			// menuItem8
			// 
			this.menuItem8.Index = 0;
			this.menuItem8.Shortcut = System.Windows.Forms.Shortcut.F1;
			this.menuItem8.Text = "C# Dom";
			this.menuItem8.Click += new System.EventHandler(this.menuItem8_Click);
			// 
			// CSharpViewer
			// 
			this.AllowDrop = true;
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.ClientSize = new System.Drawing.Size(1200, 729);
			this.Controls.AddRange(new System.Windows.Forms.Control[] {
																		  this.panel1});
			this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
			this.Menu = this.mainMenu1;
			this.Name = "CSharpViewer";
			this.Text = "CSharpViewer";
			this.panel1.ResumeLayout(false);
			this.panel3.ResumeLayout(false);
			this.tabControlCode.ResumeLayout(false);
			this.tabPageSource.ResumeLayout(false);
			this.tabPageAntlrTree.ResumeLayout(false);
			this.tabPageCSharpDom.ResumeLayout(false);
			this.tabPageRegen.ResumeLayout(false);
			this.tabStats.ResumeLayout(false);
			this.ResumeLayout(false);

		}
		#endregion

		private void menuItem5_Click(object sender, System.EventArgs e)
		{
			// File Open		
			OpenFileDialog openFileDialog1 = new OpenFileDialog();

			openFileDialog1.InitialDirectory = Environment.CurrentDirectory;
			openFileDialog1.Filter = "C# files (*.cs;*.in)|*.cs;*.in|All files (*.*)|*.*" ;
			openFileDialog1.FilterIndex = 1;
			openFileDialog1.RestoreDirectory = false;
			openFileDialog1.Multiselect = false;

			if(openFileDialog1.ShowDialog() == DialogResult.OK)
			{
				string file = openFileDialog1.FileName;
				AddFile(file);
			}
		}
		protected override void OnDragEnter(DragEventArgs e)					
		{
			base.OnDragEnter(e);
			if (e.Data.GetDataPresent(DataFormats.FileDrop) ) 
			{
				e.Effect = DragDropEffects.Copy;
			}
			else
			{
				e.Effect = DragDropEffects.None;
			}
		}
		protected override void OnDragDrop(DragEventArgs e)						
		{
			base.OnDragDrop(e);
			// Handle FileDrop data.
			if(e.Data.GetDataPresent(DataFormats.FileDrop) )
			{
				string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
				// only open first file for now...
				if(files.Length > 0 && files[0] != "")
					AddFile(files[0]);
			}

		}

		private void menuItem6_Click(object sender, System.EventArgs e)
		{
			Tree.ExpandAll();
		}

		private void menuItem7_Click(object sender, System.EventArgs e)
		{
			Tree.CollapseAll();
		}

		private void menuItem8_Click(object sender, System.EventArgs e)
		{
			if(File.Exists(@"CSharpDom.chm"))
				Help.ShowHelp(this, "CSharpDom.chm", null);
			else
				Console.WriteLine("file doesn't exist");
		}

		private void richTextBoxSource_TextChanged(object sender, System.EventArgs e)
		{
		
		}

		private void Tree_AfterSelect(object sender, System.Windows.Forms.TreeViewEventArgs e)
		{
			if(!(e.Node is IGraphNode)) return;
			LinePragma lp = ((IGraphNode)e.Node).Graph.LinePragma;
			if(lp == null) return;
			int col = lp.Column;
			int line = lp.Line;
			
			if(line == 0) return;
			string src = richTextBoxRegen.Text;
			int endIndex = 0;
			int startIndex = 0;
			int nextStartChar = 0;
			for(int i = 1; i <= lp.EndLine; i++)
			{
				if(line == i) 
					startIndex = nextStartChar;
				if(nextStartChar > 0) 
					endIndex = nextStartChar;
				nextStartChar = src.IndexOf("\n", endIndex + 1);
			}
			startIndex += lp.Column;
			endIndex += lp.EndColumn;
			int len = endIndex - startIndex;;
			if(len < 1) len = 1;
			richTextBoxRegen.Select(startIndex, len);
			richTextBoxRegen.ScrollToCaret();
		}
	}
}

⌨️ 快捷键说明

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