Поделиться через


CScrollBar::SetScrollPos

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.

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

Parameters

  • nPos
    Specifies the new position for the scroll box. 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 it is FALSE, it is not redrawn. The scroll bar is redrawn by default.

Return Value

Specifies the previous position of the scroll box if successful; otherwise 0.

Remarks

Set bRedraw to FALSE whenever the scroll bar will be redrawn by a subsequent call to another function to avoid having the scroll bar redrawn twice within a short interval.

Example

See the example for CScrollBar::SetScrollRange.

Requirements

Header: afxwin.h

See Also

Reference

CScrollBar Class

Hierarchy Chart

CScrollBar::GetScrollPos

CScrollBar::GetScrollRange

CScrollBar::SetScrollRange

SetScrollPos

Other Resources

CScrollBar Members