void SetScrollRange( int nMinPos, int nMaxPos, BOOL bRedraw = TRUE );
Parameters
nMinPos
Specifies the minimum scrolling position.
nMaxPos
Specifies the maximum scrolling position.
bRedraw
Specifies whether the scroll bar should be redrawn to reflect the change. If bRedraw is TRUE, the scroll bar is redrawn; if FALSE, it is not redrawn. It is redrawn by default.
Remarks
Sets minimum and maximum position values for the given scroll bar. Set nMinPos and nMaxPos to 0 to hide standard scroll bars.
Do not call this function to hide a scroll bar while processing a scroll-bar notification message.
If a call to SetScrollRange immediately follows a call to the SetScrollPos member function, set bRedraw in SetScrollPos to 0 to prevent the scroll bar from being redrawn twice.
The difference between the values specified by nMinPos and nMaxPos must not be greater than 32,767. The default range for a scroll-bar control is empty (both nMinPos and nMaxPos are 0).
Example
// CMyView is a CView-derived class.
void CMyView::OnInitialUpdate()
{
CView::OnInitialUpdate();
// Sets minimum (0) and maximum (10) position values for the
// CScrollBar control. m_ScrollBar is of type CScrollBar class,
// and it is a member variable in CMyView class.
m_ScrollBar.SetScrollRange(0, 10);
// Set the position of the scroll box.
m_ScrollBar.SetScrollPos(5);
// Disable the right arrow of the scroll bar. By default, both arrows
// are enabled.
m_ScrollBar.EnableScrollBar(ESB_DISABLE_RTDN);
}
CScrollBar Overview | Class Members | Hierarchy Chart
See Also CScrollBar::GetScrollPos, CScrollBar::SetScrollPos, CScrollBar::GetScrollRange, ::SetScrollRange