private void OpenNewTab(string OpenedFile) { TabInfo ti = new TabInfo(); ti.File = OpenedFile; TabPage tp = new TabPage(new FileInfo(OpenedFile).Name); tabTabs.TabPages.Add(tp); SmartTextBox rtb = new SmartTextBox(); rtb.AcceptsTab = true; rtb.Dock = DockStyle.Fill; rtb.LinkClicked += rtb_LinkClicked; rtb.Highlights = this.Highlights; rtb.Hints = Hints; rtb.Suggestions = Suggestions; Panel pnlParent = new Panel(); pnlParent.Padding = new Padding(0, 0, 0, 0); pnlParent.Controls.Add(rtb); pnlParent.Dock = DockStyle.Fill; Panel pnlNumbers = new Panel(); pnlNumbers.Dock = DockStyle.Left; pnlNumbers.Width = 35; pnlNumbers.Height = tabTabs.Height; LineLabel lLbl = new LineLabel(); lLbl.Width = pnlNumbers.Size.Width - 3; lLbl.Height = pnlNumbers.Height; lLbl.Location = new Point(0, 1); lLbl.Font = new Font(FontFamily.GenericMonospace, 8); lLbl.MouseDown += lLbl_Click; if (Helper.IsUnix()) lLbl.LineSpacing = 13f; pnlNumbers.Controls.Add(lLbl); pnlParent.Controls.Add(pnlNumbers); ti.Liner = lLbl; ti.Rtb = rtb; rtb.KeyDown += txtCode_KeyDown; rtb.SelectionTabs = new int[] { 12, 25, 37, 50 }; rtb.Font = txtLog.Font = new System.Drawing.Font(FontFamily.GenericMonospace, 8); rtb.TextChanged += txtCode_TextChanged; rtb.VScroll += txtCode_VScroll; rtb.KeyPress += txtCode_KeyPress; rtb.Tag = ti; tp.Controls.Add(pnlParent); tp.Tag = ti; if (File.Exists(OpenedFile)) { StreamReader rd = new StreamReader(OpenedFile); rtb.Text = rd.ReadToEnd(); rd.Close(); } tabTabs.SelectedTab = tp; ti.TitleFileName = new FileInfo(OpenedFile).Name; RebuildTitle(tabTabs.SelectedIndex); }
private void OpenNewTab(string OpenedFile) { TabInfo ti = new TabInfo(); ti.File = OpenedFile; TabPage tp = new TabPage(new FileInfo(OpenedFile).Name); tabTabs.TabPages.Add(tp); SmartTextBox rtb = new SmartTextBox(); rtb.AcceptsTab = true; rtb.Dock = DockStyle.Fill; rtb.LinkClicked += rtb_LinkClicked; rtb.Highlights = this.Highlights; rtb.Hints = Hints; rtb.Suggestions = Suggestions; Panel pnlParent = new Panel(); pnlParent.Padding = new Padding(0, 0, 0, 0); pnlParent.Controls.Add(rtb); pnlParent.Dock = DockStyle.Fill; Panel pnlNumbers = new Panel(); pnlNumbers.Dock = DockStyle.Left; pnlNumbers.Width = 35; pnlNumbers.Height = tabTabs.Height; LineLabel lLbl = new LineLabel(); lLbl.Width = pnlNumbers.Size.Width - 3; lLbl.Height = pnlNumbers.Height; lLbl.Location = new Point(0, 1); lLbl.Font = new Font(FontFamily.GenericMonospace, 8); lLbl.MouseDown += lLbl_Click; if (Helper.IsUnix()) { lLbl.LineSpacing = 13f; } pnlNumbers.Controls.Add(lLbl); pnlParent.Controls.Add(pnlNumbers); ti.Liner = lLbl; ti.Rtb = rtb; rtb.KeyDown += txtCode_KeyDown; rtb.SelectionTabs = new int[] { 12, 25, 37, 50 }; rtb.Font = txtLog.Font = new System.Drawing.Font(FontFamily.GenericMonospace, 8); rtb.TextChanged += txtCode_TextChanged; rtb.VScroll += txtCode_VScroll; rtb.KeyPress += txtCode_KeyPress; rtb.Tag = ti; tp.Controls.Add(pnlParent); tp.Tag = ti; if (File.Exists(OpenedFile)) { StreamReader rd = new StreamReader(OpenedFile); rtb.Text = rd.ReadToEnd(); rd.Close(); } tabTabs.SelectedTab = tp; ti.TitleFileName = new FileInfo(OpenedFile).Name; RebuildTitle(tabTabs.SelectedIndex); }