コード例 #1
0
        public void AddLineNumbers()
        {
            Point pt          = new Point(0, 0);
            int   First_Index = Editor_TextBox.GetCharIndexFromPosition(pt);
            int   First_Line  = Editor_TextBox.GetLineFromCharIndex(First_Index);

            pt.X = ClientRectangle.Width;
            pt.Y = ClientRectangle.Height;

            int Last_Index = Editor_TextBox.GetCharIndexFromPosition(pt);
            int Last_Line  = Editor_TextBox.GetLineFromCharIndex(Last_Index);

            tB_line.SelectionAlignment = HorizontalAlignment.Center;
            tB_line.Text  = "";
            tB_line.Width = getWidth();
            for (int i = First_Line; i <= Last_Line + 2; i++)
            {
                tB_line.Text += i + 1 + "\n";
            }
        }