list view scroll event for popskie or anyone else who wants it-VBForums
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
    Super Moderator Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,334

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

    Moved to C# CodeBank.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    When you have received an answer to your question, please mark it as resolved using the Thread Tools menu.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    I dont answer coding questions via PM or EMail. Please post a thread in the appropriate forum section.

    Creating A Wizard In VB.NET
    Paging A Recordset
    What is wrong with using On Error Resume Next
    Good Article: Language Enhancements In Visual Basic 2010
    Upgrading VB6 Code To VB.NET
    Microsoft MVP 2005/2006/2007/2008/2009/2010/2011/2012/Defrocked

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.