all groups > dotnet windows forms > september 2004 >
You're in the

dotnet windows forms

group:

How to monitor scrolling on richtext control


How to monitor scrolling on richtext control msdn NO[at]SPAM comsquared.com
9/11/2004 8:07:08 PM
dotnet windows forms:
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?
--
Re: How to monitor scrolling on richtext control Ken Tucker [MVP]
9/12/2004 12:39:13 PM
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
------------------
[quoted text, click to view]
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?
--
Tom Hintz

Re: How to monitor scrolling on richtext control msdn NO[at]SPAM comsquared.com
9/13/2004 7:13:07 AM
Could I bother you to provide a C# example?

/Tom Hintz

[quoted text, click to view]
Re: How to monitor scrolling on richtext control v-jetan NO[at]SPAM online.microsoft.com (
9/14/2004 9:03:34 AM
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.
Re: How to monitor scrolling on richtext control Ken Tucker [MVP]
9/14/2004 6:26:40 PM
Hi,

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwindowsformsrichtextboxclassgetcharfrompositiontopic.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemWindowsFormsRichTextBoxClassGetCharIndexFromPositionTopic.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemWindowsFormsRichTextBoxClassGetLineFromCharIndexTopic.asp

Ken
-----------------
[quoted text, click to view]
Could I bother you to provide a C# example?

/Tom Hintz

[quoted text, click to view]

Re: How to monitor scrolling on richtext control v-jetan NO[at]SPAM online.microsoft.com (
9/17/2004 3:02:01 AM
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.
Re: How to monitor scrolling on richtext control msdn NO[at]SPAM comsquared.com
9/17/2004 7:01:15 AM
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)

Re: How to monitor scrolling on richtext control msdn NO[at]SPAM comsquared.com
9/17/2004 7:01:15 AM
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)

Re: How to monitor scrolling on richtext control v-jetan NO[at]SPAM online.microsoft.com (
9/20/2004 9:40:47 AM
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.
Re: How to monitor scrolling on richtext control v-jetan NO[at]SPAM online.microsoft.com (
9/23/2004 2:51:08 AM
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.
AddThis Social Bookmark Button