Groups | Blog | Home
all groups > dotnet distributed apps > october 2005 >

dotnet distributed apps : c# - listbox scroll bar event


John Keers
10/27/2005 12:00:00 AM
Can anyone tell me how to fire and use a listBox onScroll event. The
language I am using is C# in a windows forms application

thanks

lukezhan NO[at]SPAM online.microsoft.com
10/27/2005 12:00:00 AM
Hi John,


ListBox doesnot provide a interface for your to manipulate the scrollbar
directly. As a workaround, you can try sending WM_VSCROLL message via
PInvoke. For
example:


Class Win32
{
[DllImport("User32.Dll")]
public static extern bool SendMessage(IntPtr hWnd,int Msg,int
wParam,int lParam);
public const int WM_VSCROLL = 0x0115;
public const int SB_LINEDOWN = 1;



}


Win32.SendMessage(listBox1.Handle,Win32.WM_VSCROLL,Win32.SB_LINEDOWN,0);

Hope this helps.


Regards,

Luke

AddThis Social Bookmark Button