CWnd::SetScrollPos

Syntax

int SetScrollPos( int nBar, int nPos, BOOL bRedraw = TRUE );

Parameters

nBar

Specifies the scroll bar to be set. It can be one of the following values:

Value Meaning

SB_CTL Sets the position of a scroll-bar control. In this case, the CWnd must be a scroll-bar control.
SB_HORZ Sets the CWnd horizontal scroll-bar position.
SB_VERT Sets the CWnd vertical scroll-bar position.

nPos

Specifies the new position. It must be within the scrolling range.

bRedraw

Specifies whether the scroll bar should be redrawn to reflect the new position. If bRedraw is TRUE, the scroll bar is redrawn; if FALSE, it is not redrawn.

Remarks

Sets the current position of a scroll box to that specified by nPos and, if specified, redraws the scroll bar to reflect the new position.

Setting bRedraw to FALSE is useful whenever the scroll bar will be redrawn by a subsequent call to another function.

Return Value

The previous position of the scroll box.

See Also

::SetScrollPos, CWnd::GetScrollPos