private void NrichTextBox_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { this.EditMenu.Show(e.Location); } NrichTextBox.Select(); LineNumberTextBox.DeselectAll(); }
private void lineNumbersToolStripMenuItem_Click(object sender, EventArgs e) { if (!lineNumbersToolStripMenuItem.Checked) { LineNumberTextBox.ResetText(); } else { UpdateLineCount(); } }
//Update the number margin when zoom in or zoom out private void OnTypingArea_SizeChanged(object sender, EventArgs e) { //Font fnt = new Font(FontFamily.GenericMonospace, typingArea.Font.Size); LineNumberTextBox.Font = typingArea.Font; AddLineNumbers(); LineNumberTextBox.Refresh(); LineNumberTextBox.Invalidate(); //LineNumberTextBox.ZoomFactor = typingArea.ZoomFactor; //Font fnt = new Font(FontFamily.GenericMonospace, typingArea.Font.Size * LineNumberTextBox.ZoomFactor); //LineNumberTextBox.Font=fnt; }
private void Script_textbox_KeyUp(object sender, KeyEventArgs e) { script = ScriptTextBox.Text; int linecount = ScriptTextBox.GetLastVisibleLineIndex() + 1; if (linecount != maxLC) { LineNumberTextBox.Clear(); for (int i = 1; i < linecount + 1; i++) { LineNumberTextBox.AppendText(Convert.ToString(i) + "\n"); } maxLC = linecount; } SaveStatus.Content = "Changed"; }
private void OnTypingArea_VScroll(object sender, EventArgs e) { LineNumberTextBox.Text = ""; //AddLineNumbers(); AddLineNumbers(); LineNumberTextBox.Refresh(); DocumentMap.Refresh(); //Method to synchronize scroll between Typing Area and Document Map //Reference: https://stackoverflow.com/questions/1827323/c-synchronize-scroll-position-of-two-richtextboxes int nPos = GetScrollPos(TypingArea.Handle, (int)ScrollBarType.SbVert); nPos <<= 16; uint wParam = (uint)ScrollBarCommands.SB_THUMBPOSITION | (uint)nPos; SendMessage(DocumentMap.Handle, (int)Message.WM_VSCROLL, new IntPtr(wParam), new IntPtr(0)); }
private void addLineNumbers() { Point pt = new Point(0, 0); int First_Index = richTextBox1.GetCharIndexFromPosition(pt); int First_Line = richTextBox1.GetLineFromCharIndex(First_Index); pt.X = ClientRectangle.Width; pt.Y = ClientRectangle.Height; int Last_Index = richTextBox1.GetCharIndexFromPosition(pt); int Last_Line = richTextBox1.GetLineFromCharIndex(Last_Index); LineNumberTextBox.SelectionAlignment = HorizontalAlignment.Right; LineNumberTextBox.Text = ""; for (int i = First_Line; i < Last_Line + 1; i++) { LineNumberTextBox.Text += i + 1 + "\n"; } LineNumberTextBox.Invalidate(); }
private void LineNumberTextBox_MouseDown(object sender, MouseEventArgs e) { richTextBox1.Select(); LineNumberTextBox.DeselectAll(); }
private void richTextBox1_VScroll(object sender, EventArgs e) { LineNumberTextBox.Text = ""; AddLineNumbers(); LineNumberTextBox.Invalidate(); }
private void OnTypingArea_MouseDown(object sender, MouseEventArgs e) { typingArea.Select(); LineNumberTextBox.DeselectAll(); }
/// <summary> /// Draws the given rail in the group box. /// </summary> /// <param name="rail">The rail to draw.</param> /// <param name="x">The x starting point.</param> /// <param name="startY">The y starting point.</param> private void DrawMultipleSectorRail(Rail rail, int x, int startY) { int y = startY; RailNumberTextBox rntb = new RailNumberTextBox(rail, new Point(x, y)); rntb.ContextMenu = this.CreateRailContextMenu(); this.gbOverview.Controls.Add(rntb); y += rntb.Size.Height; LineNumberTextBox lntb = new LineNumberTextBox(rail.Line, new Point(x, y)); this.gbOverview.Controls.Add(lntb); y += lntb.Size.Height; rail.Sectors.Sort(); foreach (Sector sector in rail.Sectors) { SectorTextBox stb = new SectorTextBox(sector, new Point(x, y)); stb.ContextMenu = this.CreateSectorContextMenu(); this.gbOverview.Controls.Add(stb); y += stb.Size.Height; } }
private void rtxCodigoFuente_VScroll(object sender, EventArgs e) { LineNumberTextBox.Text = ""; AddLineNumbers(); LineNumberTextBox.Invalidate(); }
private void LineNumberTextBox_MouseDown(object sender, MouseEventArgs e) { rtxCodigoFuente.Select(); LineNumberTextBox.DeselectAll(); }
private void LineNumberTextBox_MouseDown(object sender, MouseEventArgs e) { TxtEditorTexto.Select(); LineNumberTextBox.DeselectAll(); }
private void richTextBox1_TextChanged(object sender, EventArgs e) { UpdateLineCount(); LineNumberTextBox.SelectionStart = richTextBox1.Text.Length; LineNumberTextBox.ScrollToCaret(); }