By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,376 Members | 1,566 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,376 IT Pros & Developers. It's quick & easy.

rich text box, finding line #, scrolling to specific line

P: n/a

my app has two parallel rich text boxes containing the same content in 2
different languages. the lines parallel each other, line #3 in english
contains the same content as line #3 in french.

i need the two boxes to syncronize, if someone scrolls and clicks on line 23
in the english side, it should scroll to line 23 in the french side, and the
same from french to english.

i know that text stored in a rich text box is stored in a string array of
the name rtb.lines.

i need to be able to 1) determine in which line a text was clicked, 2) make
the other box scroll to the same line.

as to 1) the only way i can see doing it is counting the number of crlf's
from the start of the text, which i would prefer not to do because it would
take too long as the text is very long. the other way is to insert some
invisible text in each line indicating the line #, but i don't know how to
make the text invisible (the text without these markers also needs to be
printable). anybody have an idea how to know which line was clicked?

also is there a way to know at least which line is currently at the top of
the control?

as to 2) i can think of counting crlf to match the count of the text clicked
in the other rich text box control, locate the caret there, and use the
ScrollToCaret method, but that works only if the control has the focus, and
the user is clicking in the other rich text box? any idea how to scroll a
rich text box to a certain line?

i can't use the 'Find' method, for though the contents are parallel, the
texts are not.

is there a method to know where the caret is located?

thanks for any help


Nov 21 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.