S Scott Toney Aug 17, 2005 #1 I have 2 listviews, one with a scrollbar. What is my best way to have the one scrollbar scroll both listviews? Thanks Scott
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 Aug 17, 2005 #2 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);
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);