Thanks. It looks like this is part of the solution. WM_VSCROLL notification
is sent more often than I want to handle this event (eg twice for every
scroll button click), and it isn't sent at some times I want to be notified
(like up/down arrows causing a scroll.) To catch it only when I want it,
I'll need to look at the wParam. I can choose either SB_THUMBPOSITIO N or
SB_THUMBTRACK (depending on whether I want to update only when the mouse is
released or during scrolling), but I will need to avoid looking at the
high-order word if I want to test for equality (which I do, since these are
not defined as flags -- they are 4 and 5 repectively.)
I believe it will work to use the existing VScroll event, and do something
like this:
protected override void WndProc(ref System.Windows. Forms.Message m)
{
if ( m.Msg == WM_VSCROLL &&
(short) m.WParam == SB_THUMBPOSITIO N )
OnVScroll( this, EventArgs.Empty );
base.WndProc ( ref m );
}
-Rachel
"hyuki" <hy***@inbrein. com> wrote in message
news:Oe******** ******@tk2msftn gp13.phx.gbl...
Rachel
Try to use the WM_VSCROLL event.
//example:
public class HRichTextBox : System.Windows. Forms.RichTextB ox
{
private const int WM_VSCROLL = 277;
public event System.EventHan dler OnVerticalScrol l;
public HRichTextBox()
{
}
protected override void WndProc(ref System.Windows. Forms.Message m)
{
if(m.Msg == WM_VSCROLL && OnVerticalScrol l != null)
OnVerticalScrol l(this, new System.EventArg s()); // your new
vscroll event handler
base.WndProc (ref m);
}
}
Yong Hyeok Seo
hy***@inbrein.c om
MCAD, MVP[C#]
"Rachel Suddeth" <ra****@bldhoun d.com> wrote in message
news:eL******** *****@TK2MSFTNG P15.phx.gbl...I want to react to scrolls in a RichTextBox (I want to let the user know
when he has changed to a new printable page.) I have handled the
VScroll() event, but that only responds to scrollbar clicks. If the user slides
the "thumb", I seem to get no indication. Anyone know how to get notified of
the
thumb slide from a RichTextBox? I can derive from RichTextBox and trap
messages if need be, but I have not been able to figure out what to
respond
to (and I'm still hoping for a better way that I don't have to create a
derived class?)
-Rachel