question

MuhammadTaha-9825 avatar image
0 Votes"
MuhammadTaha-9825 asked AxD edited

Is there a built-in method to display line numbers in rich text box c# .net framework?

I am creating a text editor in windows form app c# .net framework. So, I want to display line numbers of Rich text box on left side. Is there a built-in control or function to do this?

dotnet-csharpwindows-forms
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

AxD avatar image
0 Votes"
AxD answered AxD edited

Unfortunately, no.

That would be a feature too specialized for a control that's capable of displaying text in loads of fancy ways.

In your case (with fixed line heights, I presume) you'd be required to add a second control aside the RichTextBox control to display the line numbers and keep its content in sync with the text displayed in the RichTextBox control.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

WayneAKing-0228 avatar image
0 Votes"
WayneAKing-0228 answered

Have you read this thread?

How to show number of a line in a RichTextBox C#
https://stackoverflow.com/questions/2567263/how-to-show-number-of-a-line-in-a-richtextbox-c-sharp

  • Wayne

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.