Programmatically
scrolling a ListView or TreeView
It is really simple to programmatically
scroll a ListView, TreeView, or most any windowed control by using the
WM_VSCROLL and WM_HSCROLL messages and the SendMessage API function.
KEYWORDS:
SendMessage, WM_HSCROLL, WM_VSCROLL
|
//---------------------------------------------------------------------------
//Scroll
a ListView vertically down
SendMessage(ListView1->Handle,
WM_VSCROLL, SB_LINEDOWN, 0);
//Scroll
a TreeView vertically up
SendMessage(TreeView1->Handle,
WM_VSCROLL, SB_LINEUP, 0);
|
Other scroll parameters that can be sent...
SB_BOTTOM Scrolls to the lower right.
SB_ENDSCROLL Ends scroll.
SB_LINEDOWN Scrolls one line down.
SB_LINEUP Scrolls one line up.
SB_PAGEDOWN Scrolls one page down.
SB_PAGEUP Scrolls one page up.
SB_THUMBPOSITION Scrolls to the absolute position. The current position
is specified by the nPos parameter.
SB_THUMBTRACK Drags scroll box to the specified position. The current
position is specified by the nPos parameter.
SB_TOP Scrolls to the upper left.
|