> detect when the ListView is scrolled,
See class below, I found it on internet and have modified it so it works
when half visible item is clicked as well.
Also, you will need to update designer in 2 spots, from ListView to
xListView. If you have any problem with that just reply.
Public Class xListView
'NOTE take from internet somewhere - pureley to capture topitem change from
scroll
' - but has proven to be helpfull on half item click as well
Inherits Windows.Forms.ListView
Private Const WM_VSCROLL As Integer = &H115
Enum ScrollBarActions As Integer
SB_LINEUP = &H0
SB_LINEDOWN = &H1
SB_PAGEUP = &H2
SB_PAGEDOWN = &H3
SB_THUMBPOSITION = &H4
SB_THUMBTRACK = &H5
SB_TOP = &H6
SB_BOTTOM = &H7
SB_ENDSCROLL = &H8
End Enum
Event IMovedEvent()
Private Var1() As String
Private Var2() As String
Protected Overrides Sub wndProc(ByRef m As Message)
'HACK fix attempt for selcting bottem item which is split
With m.WParam
If m.Msg.Equals(&H115) And .ToInt32 = ScrollBarActions.SB_ENDSCROLL Then
RaiseEvent IMovedEvent()
End If
'MESSAGE = SCROLLED, BUT ACTS LIKE SELECTED INDEX CHANGE(SINGULAR)
If m.Msg.Equals(&H113) Then
RaiseEvent IMovedEvent()
End If
End With
MyBase.WndProc(m)
End Sub
Private Sub xListView_KeyDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
Select Case e.KeyCode
Case Keys.Up, Keys.Down, Keys.PageDown, Keys.PageUp
Console.WriteLine("Raising IMovedEvent")
RaiseEvent IMovedEvent()
End Select
End Sub
End Class
Arrick - 14 Feb 2006 23:18 GMT
Thanks -- overriding WndProc and detecting WM_VSCROLL was the idea I needed.
> > detect when the ListView is scrolled,
>
[quoted text clipped - 85 lines]
>
> End Class