private void openToolStripMenuItem_Click(object sender, EventArgs e) { using (OpenFileDialog dialog = new OpenFileDialog()) { dialog.CheckFileExists = true; dialog.Filter = "Assembler .net|*.asmn"; dialog.Multiselect = false; dialog.Title = "Select a Assembler .net source code file"; if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { if (File.Exists(dialog.FileName)) { FATabStripItem tab = new FATabStripItem(); tab.Title = dialog.FileName; faTabStrip1.AddTab(tab); TextboxHighlighting txtHighlighting = new TextboxHighlighting(); txtHighlighting.ContextMenuStrip = contextMenuStrip2; txtHighlighting.UpdateControl(); txtHighlighting.Width = tab.Width; txtHighlighting.Height = tab.Height; txtHighlighting.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top; txtHighlighting.Text = File.ReadAllText(dialog.FileName); tab.Controls.Add(txtHighlighting); } else { MessageBox.Show("The file does not exist"); } } } }
public void CreateNewTab(string Text, string TabTitle) { FATabStripItem tab = new FATabStripItem(); tab.Title = TabTitle; faTabStrip1.AddTab(tab); TextboxHighlighting txtHighlighting = new TextboxHighlighting(); txtHighlighting.ContextMenuStrip = contextMenuStrip2; txtHighlighting.UpdateControl(); txtHighlighting.Width = tab.Width; txtHighlighting.Height = tab.Height; txtHighlighting.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top; tab.Controls.Add(txtHighlighting); txtHighlighting.Text = Text; }
private void newToolStripMenuItem_Click(object sender, EventArgs e) { FATabStripItem tab = new FATabStripItem(); tab.Title = "new.asmn"; faTabStrip1.AddTab(tab); TextboxHighlighting txtHighlighting = new TextboxHighlighting(); txtHighlighting.ContextMenuStrip = contextMenuStrip2; txtHighlighting.UpdateControl(); txtHighlighting.Width = tab.Width; txtHighlighting.Height = tab.Height; txtHighlighting.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top; tab.Controls.Add(txtHighlighting); txtHighlighting.Text = "namespace Sample\r\n{\r\n\tpublic class Sample\r\n\t{\r\n\t}\r\n}"; }