ScrollBar move event?

  • Thread starter Thread starter Michael
  • Start date Start date
M

Michael

Hi, there,
I need to intercept scrollbar move event for a panel
control to do something. But I cannot seem to find any
event in ScrollControls that can let me do that.
Thanks for the help.

Michael
 
Hi,

You have to create an inherited control. Override WndProc the
wm_hscroll and wm_vscroll messages are sent when the panel is scrolled.

Public Class ScrollPanel

Inherits System.Windows.Forms.Panel



Public Event PanelScroll(ByVal sender As Object, ByVal e As EventArgs)

Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)

Const WM_HSCROLL = &H114

Const WM_VSCROLL = &H115

If m.Msg = WM_HSCROLL Or m.Msg = WM_VSCROLL Then

RaiseEvent PanelScroll(Me, New EventArgs)

End If

MyBase.WndProc(m)

End Sub

End Class

Ken
 

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

Back
Top