I want to make an event for the scroll in ListView.
I have found something that works, but it only fires the event when using the scrollbar. It does not respond to scrolling by mouse wheel or arrows.
private const int WM_HSCROLL = 0x114;
private const int WM_VSCROLL = 0x115;
public event EventHandler Scroll;
protected void OnScroll()
{
if (this.Scroll != null)
this.Scroll(this, EventArgs.Empty);
}
protected override void WndProc(ref System.Windows.Forms.Message m)
{
base.WndProc(ref m);
if (m.Msg == WM_HSCROLL || m.Msg == WM_VSCROLL )
this.OnScroll();
}
What constant do I need to fire the scroll event for the mouse wheel and keyboard up/down button?