Пример #1
0
 //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;
 }
Пример #2
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 richTextBox1_VScroll(object sender, EventArgs e)
 {
     LineNumberTextBox.Text = "";
     AddLineNumbers();
     LineNumberTextBox.Invalidate();
 }
Пример #4
0
 private void rtxCodigoFuente_VScroll(object sender, EventArgs e)
 {
     LineNumberTextBox.Text = "";
     AddLineNumbers();
     LineNumberTextBox.Invalidate();
 }