Results 1 to 2 of 2

Thread: list view scroll event for popskie or anyone else who wants it

  1. #1

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428

    list view scroll event for popskie or anyone else who wants it

    ugh I dont remember who, but a long while ago someone in the api forum told me the correct wm message for this (hack or megatron I assume )

    Here's a sample. I'm using this class instead of listview. Note that it's not a perfect solution, as the scroll event is raised for any key that's pressed in the listview (optimally you want to check for the arrow keys only), and it's also raised with a mouse scroll event (even if the list doesnt scroll.... but still it's a good enough solution

    here's the class:
    Code:
    using System.Windows.Forms;
    
    public class ListViewEx:ListView
    {
    	private const int WM_HSCROLL	= 0x0114;
    	private const int WM_VSCROLL    = 0x0115;
    	private const int WM_KEYDOWN    = 0x0100;
    	private const int WM_MOUSEWHEEL = 0x020A;
    
    	public event System.EventHandler ScrollEvent;
    		
    	protected override void WndProc(ref Message m)
    	{
    		if (m.Msg == WM_VSCROLL  || 
    			m.Msg == WM_HSCROLL  ||
    			m.Msg == WM_KEYDOWN	 ||
    			m.Msg == WM_MOUSEWHEEL)
    			if (ScrollEvent != null)
    				ScrollEvent (this, null);
    
    
    		base.WndProc (ref m);
    	}
    
    }
    and see the sample project if you want
    Attached Files Attached Files
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: list view scroll event for popskie or anyone else who wants it

    Moved to C# CodeBank.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width