tags:

views:

63

answers:

2

I'm working on displaying lines numbers for a richTextBox on C#, I tried many components but non of them worked with me, so I'm working on my own one.

I implemented that using the richTextBox + ListBox.

But, I'm having a problem when scrolling the richtextbox,the ListBox wont scroll, also I need not the vScrollBar of the List box to appear during scroll how can I accomplish this?

I mean scrolling both (richTextBox+listBox) when scrolling the richTextBox only, any suggestions?

A: 

Add a listener on an OnScroll* event and update the other control as one of them is scrolled.

deemoowoor
+1  A: 

You can't make this reliable. RichTextBox allows continuous scrolling where only a portion of a line is in view. ListBox does not. The line numbers will not line up with the lines most of the time.

Use a real text editor, like ScintillaNET. It supports showing line numbers.

Hans Passant