Adding Line Numbers to a text box?
-
i would like to add line numbers to a richTextBox, does anyone know of an easy way of doing this? i was thinking about having two text boxes controlled by the same scroll bar but i dont know how to link them up? or is it easier to use a different control to add the line numbers? Any help would be extreemly useful as i dont remember seeing an example of this or anything similar anywhere!
-
i would like to add line numbers to a richTextBox, does anyone know of an easy way of doing this? i was thinking about having two text boxes controlled by the same scroll bar but i dont know how to link them up? or is it easier to use a different control to add the line numbers? Any help would be extreemly useful as i dont remember seeing an example of this or anything similar anywhere!
I was thinking about how to design a custom control with the same functionality for the richTextBox. My initial approach would be to use a panel along the left side and set its dock property to left and the richTextBox to fill. I think there would have to be some sort of callback to the panel so it knows to update the line numbers. I do not know if this is the correct approach but it could be a start for further discussion on this topic. I would be interested in seeing the best method to do this. Regards, Brandon
-
I was thinking about how to design a custom control with the same functionality for the richTextBox. My initial approach would be to use a panel along the left side and set its dock property to left and the richTextBox to fill. I think there would have to be some sort of callback to the panel so it knows to update the line numbers. I do not know if this is the correct approach but it could be a start for further discussion on this topic. I would be interested in seeing the best method to do this. Regards, Brandon
My only reason for thinking of using two of the same text controls was an easy way to keep line numbers in the correct place as they could both share the same font and would have equal spaces in the line numbering i thought it would then be a simple task to get them to scroll together and somehow lock the textbox displaying the numbers so that it wouldn't highlight or selct on click, it would just appear next to it.