G
Guest
I've constructed a user control inherited from ListView so I can handle and
respond to scrolling events (to keep 2 listviews scrolling in sync).
My user control includes an Overrides of WndProc (I've attached the code at
the end of this mail). Is it possible to 'disable' this override until I need
it - it's just when I populate the ListViews this sub is called repeatadly.
What I'd like to do is populate the listviews and then 'enable' this override
to catch and trigger a scrolling event.
tia
Rob
Protected Overrides Sub WndProc(ByRef m As Message)
MyBase.WndProc(m)
If m.Msg = WM_VSCROLL OrElse m.Msg = WM_MOUSEWHEEL Then
RaiseEvent VerticalScroll(Nothing, Nothing)
ElseIf m.Msg = WM_NOTIFY Then
Dim lParam As NMHDR = CType(m.GetLParam(GetType(NMHDR)), NMHDR)
If lParam.code = NM_HOVER Then
OnMouseHover(EventArgs.Empty)
End If
ElseIf m.Msg = LVM_ENSUREVISIBLE Then
RaiseEvent VerticalScroll(Nothing, Nothing)
End If
End Sub
respond to scrolling events (to keep 2 listviews scrolling in sync).
My user control includes an Overrides of WndProc (I've attached the code at
the end of this mail). Is it possible to 'disable' this override until I need
it - it's just when I populate the ListViews this sub is called repeatadly.
What I'd like to do is populate the listviews and then 'enable' this override
to catch and trigger a scrolling event.
tia
Rob
Protected Overrides Sub WndProc(ByRef m As Message)
MyBase.WndProc(m)
If m.Msg = WM_VSCROLL OrElse m.Msg = WM_MOUSEWHEEL Then
RaiseEvent VerticalScroll(Nothing, Nothing)
ElseIf m.Msg = WM_NOTIFY Then
Dim lParam As NMHDR = CType(m.GetLParam(GetType(NMHDR)), NMHDR)
If lParam.code = NM_HOVER Then
OnMouseHover(EventArgs.Empty)
End If
ElseIf m.Msg = LVM_ENSUREVISIBLE Then
RaiseEvent VerticalScroll(Nothing, Nothing)
End If
End Sub