public frm_editor() { InitializeComponent(); srt_ac = new SyntaxRichTextBox(); YeniSekme(null, null); colorTabControl1.AllowDrop = true; colorTabControl1.DragEnter += new DragEventHandler(colorTabControl1_DragEnter); colorTabControl1.DragDrop += new DragEventHandler(colorTabControl1_DragDrop); }
public void YeniSekme(object sender, EventArgs e) { TabPage sayfa = new TabPage(); sayfa.Text = "Yeni Sekme"; sayfa.ForeColor = Color.White; srt_ac = new SyntaxRichTextBox(); srt_ac.Dock = DockStyle.Fill; srt_ac.BorderStyle = BorderStyle.None; srt_ac.ScrollBars = RichTextBoxScrollBars.Both; srt_ac.WordWrap = false; srt_ac.ForeColor = Color.White; srt_ac.BackColor = Color.FromArgb(30, 30, 30); srt_ac.Settings.Keywords.Clear(); srt_ac.Settings.KeywordColor = Color.White; srt_ac.Settings.Keywords.AddRange(new string[] { "null" }); srt_ac.Settings.Comment = ""; srt_ac.Settings.EnableStrings = false; srt_ac.Settings.EnableIntegers = false; srt_ac.AcceptsTab = true; srt_ac.MouseDown += delegate(object sender2, MouseEventArgs ev) { if (ev.Button == System.Windows.Forms.MouseButtons.Right) { ContextMenu contextMenu = new System.Windows.Forms.ContextMenu(); MenuItem menuItem = new MenuItem("Kes"); menuItem.Click += delegate { try { srt_ac.Cut(); } catch { } }; contextMenu.MenuItems.Add(menuItem); menuItem = new MenuItem("Kopyala"); menuItem.Click += delegate { try { Clipboard.SetText(srt_ac.SelectedText); } catch { } }; contextMenu.MenuItems.Add(menuItem); menuItem = new MenuItem("Yapıştır"); menuItem.Click += delegate { if (Clipboard.ContainsText()) { srt_ac.Text += Clipboard.GetText(TextDataFormat.Text).ToString(); } }; contextMenu.MenuItems.Add(menuItem); menuItem = new MenuItem("Hepsini Seç"); menuItem.Click += delegate { try { srt_ac.SelectAll(); srt_ac.Focus(); } catch { } }; contextMenu.MenuItems.Add(menuItem); srt_ac.ContextMenu = contextMenu; } }; srt_ac.KeyPress += delegate(object sender2, KeyPressEventArgs ev) { if (ev.KeyChar == 9) { ev.Handled = false; } }; srt_ac.CompileKeywords(); sayfa.Controls.Add(srt_ac); //pagevievpagede usercontrolü aç colorTabControl1.Controls.Add(sayfa); //sekme olarak ekler colorTabControl1.SelectedTab = sayfa; //yeni sekme açıldığında aktif sayfa ol }