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
 
Back
Top