After much research I finally came up with a .net vb solution :-)
Public Class Form1
Public Class ControlScrollListener
Inherits NativeWindow
Implements IDisposable
' Event
Public Event Scroll As ScrollEventHandler
Public Delegate Sub ScrollEventHandler(ByVal sender As Object, ByVal e As EventArgs)
' Flag: Has Dispose already been called?
Private Disposed As Boolean
' Windows message for Horizontal Scroll
Private Const WM_HSCROLL As UInteger = &H114
' Windows message for Vertical Scroll
Private Const WM_VSCROLL As UInteger = &H115
' Windows message for mouse wheel
Private Const WM_MOUSEWHEEL As UInteger = &H20A
' The control object
Private sender As Control
''' <summary>
''' Constructor
''' </summary>
Public Sub New()
sender = Nothing
End Sub
''' <summary>
''' Constructor
''' </summary>
''' <param name="control">The control object</param>
Public Sub New(ByVal control As Control)
sender = control
AssignHandle(sender.Handle)
End Sub
''' <summary>
''' Public implementation of Dispose pattern callable by consumers.
''' </summary>
Public Sub Dispose() Implements IDisposable.Dispose
Dispose(True)
GC.SuppressFinalize(Me)
End Sub
''' <summary>
''' Invokes the default window procedure associated with this window
''' </summary>
''' <param name="m">A Message that is associated with the current Windows message.</param>
''' <remarks>This method is called when a window message is sent to the handle of the window</remarks>
Protected Overrides Sub WndProc(ByRef m As Message)
HandleControlScroll(m)
MyBase.WndProc(m)
End Sub
''' <summary>
''' Protected implementation of Dispose pattern.
''' </summary>
''' <param name="disposing">The boolean value for disposing object</param>
Protected Overridable Sub Dispose(ByVal disposing As Boolean)
If Disposed Then Return
If disposing Then
' Free any other managed objects here.
sender = Nothing
End If
' Free any unmanaged objects here.
ReleaseHandle()
Disposed = True
End Sub
''' <summary>
''' Handle control scroll
''' </summary>
''' <param name="m">A Message that is associated with the current Windows message.</param>
Private Sub HandleControlScroll(ByVal m As Message)
If m.Msg = WM_HSCROLL Or m.Msg = WM_VSCROLL Or m.Msg = WM_MOUSEWHEEL Then
If Not sender Is Nothing Then
RaiseEvent Scroll(sender, New EventArgs())
End If
End If
End Sub
End Class
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles Me.Load
'Creating the list items
Dim ListItem1 As ListViewItem
ListItem1 = ListView1.Items.Add("Item 1")
Dim ListItem2 As ListViewItem
ListItem2 = ListView1.Items.Add("Item 2")
Dim ListItem3 As ListViewItem
ListItem3 = ListView1.Items.Add("Item 3")
Dim ListItem4 As ListViewItem
ListItem4 = ListView1.Items.Add("Item 4")
ListView1.View = View.SmallIcon
Dim scrollListener As New ControlScrollListener(ListView1)
AddHandler scrollListener.Scroll, AddressOf listview1_scroll
End Sub
Private Sub listview1_scroll(sender As Object, e As EventArgs)
'here you capture the scroll and do something with it !
'example: msgbox("Scroll happen !")
End Sub
End Class