ListView

S

Scott Toney

I have 2 listviews, one with a scrollbar. What is my best way to have the
one scrollbar scroll both listviews?

Thanks
Scott
 
S

Sergey Bogdanov

If you send WM_VSCROLL to a listview window handle you will scroll its
vertical scrollbar. Here is a small example how it can be done:


lsitView.Capture = true;
IntPtr hwnd = GetCapture();
lsitView.Capture = false;

SendMessage(hwnd, WM_VSCROLL, SB_LINEDOWN, 0);

....


const int WM_VSCROLL = 0x115;
const int SB_LINEUP = 0;
const int SB_LINEDOWN = 1;
const int SB_PAGEUP = 2;
const int SB_PAGEDOWN = 3;


[DllImport("coredll.dll")]
extern static IntPtr GetCapture();
[DllImport("coredll.dll")]
extern static int SendMessage(IntPtr hWnd, uint Msg, int WParam, int
LParam);
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top