471,337 Members | 1,125 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,337 software developers and data experts.

How to Get the value of scrollbar

Hi!

I am making an application and need to capture the event when RichTexBox
control's vertical scrollbar's values changes. There is an event named
VScroll but it is fired when mouse is first time clicked on scroll bar. I
need the event when the value of scroll bar changes like when we drag the
bullet on the scroll bar or when we manually press the down/Up arrow
button when the textbox is in focus and text is scrolled up or down.

How can I get the value of scrollbar when the event is fired?

It doesn't fire when the bar is pulled....

Any help will be highly appreciated

Thanks in advance

Ahmad Jalil qarshi
Jan 2 '06 #1
2 3459

Ahmad Jalil Qarshi wrote:
Hi!

I am making an application and need to capture the event when RichTexBox
control's vertical scrollbar's values changes. There is an event named
VScroll but it is fired when mouse is first time clicked on scroll bar. I
need the event when the value of scroll bar changes like when we drag the
bullet on the scroll bar or when we manually press the down/Up arrow
button when the textbox is in focus and text is scrolled up or down.

How can I get the value of scrollbar when the event is fired?


Odds are, you can't, at least not with a standard RichTextBox. C#
doesn't
allow for every single event to be captured, just the ones that
programmer
originally thought about.

All is not lost, however. To do this, just derive your own class from
RichTextBox,
override the window procedure, capture the messages you want (in your
case,
WM_VSCROLL with its various parameters set) and create your own events
for it. It really isn't very hard to do, you can find fairly good
examples on
codeproject.com, for example.

Although this particular example is for a listbox, you should be able
to see the
technique involved:
http://www.codeproject.com/cs/combob...ingListbox.asp

Matt

Jan 2 '06 #2
Thanks Matt
"Matt" <ma********@sprynet.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...

Ahmad Jalil Qarshi wrote:
Hi!

I am making an application and need to capture the event when RichTexBox
control's vertical scrollbar's values changes. There is an event named
VScroll but it is fired when mouse is first time clicked on scroll bar.
I
need the event when the value of scroll bar changes like when we drag
the
bullet on the scroll bar or when we manually press the down/Up arrow
button when the textbox is in focus and text is scrolled up or down.

How can I get the value of scrollbar when the event is fired?


Odds are, you can't, at least not with a standard RichTextBox. C#
doesn't
allow for every single event to be captured, just the ones that
programmer
originally thought about.

All is not lost, however. To do this, just derive your own class from
RichTextBox,
override the window procedure, capture the messages you want (in your
case,
WM_VSCROLL with its various parameters set) and create your own events
for it. It really isn't very hard to do, you can find fairly good
examples on
codeproject.com, for example.

Although this particular example is for a listbox, you should be able
to see the
technique involved:
http://www.codeproject.com/cs/combob...ingListbox.asp

Matt

Jan 3 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Doug Carter | last post: by
4 posts views Thread by Price Brattin | last post: by
reply views Thread by d.steininger | last post: by
reply views Thread by =?Utf-8?B?R2lkaQ==?= | last post: by
1 post views Thread by Victor Hadianto | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.