mercoledì 3 giugno 2009

Listview Scroll event

with great surprise I discovered that ListView control does not have the management of onScroll event, or at least something similar to handle the scroll.

To work around this problem we have to derive the ListView and create a personalized as in this example, then you can complete it according to your needs, however, simply get the events HorizontalScroll and VerticalScroll

Imports System.Windows.Forms
Imports System.Drawing
Public Class ImprovedListView
Inherits ListView
Private WM_HSCROLL As Integer = &H114
Private WM_VSCROLL As Integer = &H115
Public Event HorizontalScroll ()
Public Event VerticalScroll()
Protected Overrides Sub WndProc(ByRef m As Message)
Select Case (m.Msg)
Case WM_VSCROLL
RaiseEvent VerticalScroll
Case WM_HSCROLL
RaiseEvent HorizontalScroll
End Select
MyBase.WndProc(m)
End Sub
End Class

0 commenti:

Posta un commento