How can I catch arrow key event in a scrollable control

G

Guest

Hi

I have a scrollable control and I want to catch arrow key event

When I press arrow key one of the two scrollbar box starts blinking and I don't know how can I stop that. Besides it seems that keydown eventhandler is disabled

Could someone tell me how work scrollbar and reference manual to know in more detail this behaviour

Thanks in advance
 
G

Guest

Hello,

FRom what you said, your scrollable control seems to be a custom control(Forgive me if i am wrong). Well, assuming that it is, and that you code with VB.net (porting the same to C# is easy if you try), then try overridding the controls WndProc method as shown below:-

'DECLARE THESE CONSTANTS
'WE are looking for these scrolling related messages that Windows sends to our control
Private Const WM_VSCROLL = &H115
Private Const WM_HSCROLL = &H114
...................................
...................................
'Now catch these messages here and perform some custom action
Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
MyBase.WndProc(m)
If m.Msg = WM_VSCROLL Or m.Msg = WM_HSCROLL Then
'do something here
End If
End Sub

I have not found any other way to catch the scroll events period(am i lazy or what?).
 

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