How to monitor scrolling on richtext control

G

Guest

I want to show custom regions of interest on the .NET richtext control by
placing transparent controls on it in various shapes. For example, I want to
highlight a column of text such that the highlight follows the text when it
is scrolled.

To do this I need to prevent the control's native text selection operation.
I can easily accomplish that by placing a transparent panel over the richtext
control's client area, and then painting the controls on that.

However, the control's scrollbar thumbs don't raise any events that allow
the controls to track the position of the corresponding text. How can I
determine which text is visible after a scrolling action?
 
K

Ken Tucker [MVP]

Hi,

I make a control extender that uses the nativewindows class to
listen for scroll messages. It than uses an api call to get the scroll
position. maybe this will help
www.onteorasoftware.com/downloads/scrolllistener.zip

Ken
------------------
I want to show custom regions of interest on the .NET richtext control by
placing transparent controls on it in various shapes. For example, I want
to
highlight a column of text such that the highlight follows the text when it
is scrolled.

To do this I need to prevent the control's native text selection operation.
I can easily accomplish that by placing a transparent panel over the
richtext
control's client area, and then painting the controls on that.

However, the control's scrollbar thumbs don't raise any events that allow
the controls to track the position of the corresponding text. How can I
determine which text is visible after a scrolling action?
 
J

Jeffrey Tan[MSFT]

Hi Tom,

Which part of the VB.net project you have the C# converting problem? You
may paste the code snippet you have problem to convert, we will help you.

Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
J

Jeffrey Tan[MSFT]

Hi Tom,

Is your problem resolved? If you still have the code convertion problem,
please feel free to tell me, thanks.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
G

Guest

We called the MSDN support number, and a knowledgeable lady directly answered
our question in C#. The bottom line is that we need to capture the windows
scrollbar messages directly and translate them to events. Seems lame, but we
got the job done. What ever could the point have been for providing only
SOME scroll events? A job well begun is half done (Marry Poppins)

/Tom Hintz
 
J

Jeffrey Tan[MSFT]

Hi Tom,

Thanks for your feedback.

Yes, the sample code provided by Ken in VB.net also uses the same way:
intercept the richtextbox scroll message and fire customized scroll event.
Because .Net RichTextBox control did not have scroll event build-in, we
have to do in this way.

If you still have any concern, please feel free to tell me, I will help
you.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
J

Jeffrey Tan[MSFT]

Hi Tom,

Yes, I see your concern: why .Net Framework did not provide RichTextBox a
build-in support for scroll event. I think your concern makes sense, I will
forward this issue to our product team.
Also, you may feedback it through:
http://register.microsoft.com/mswish/suggestion.asp
Your feedback will help us to improve our product.

Thanks very much!

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top