CWnd::SetScrollRange

Sets minimum and maximum position values for the given scroll bar.

void SetScrollRange( 
   int nBar, 
   int nMinPos, 
   int nMaxPos, 
   BOOL bRedraw = TRUE  
);

Parameters

  • nBar
    Specifies the scroll bar to be set. This parameter can be either of the following values:

    • SB_HORZ   Sets the range of the horizontal scroll bar of the window.

    • SB_VERT   Sets the range of the vertical scroll bar of the window.

  • 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, the scroll bar is not redrawn.

Remarks

It can also be used to hide or show standard scroll bars.

An application should not call this function to hide a scroll bar while processing a scroll-bar notification message.

If the call to SetScrollRange immediately follows a call to the SetScrollPos member function, the bRedraw parameter in the SetScrollPos member function should be 0 to prevent the scroll bar from being drawn twice.

The default range for a standard scroll bar is 0 through 100. The default range for a scroll bar control is empty (both the nMinPos and nMaxPos values are 0). The difference between the values specified by nMinPos and nMaxPos must not be greater than INT_MAX.

Requirements

Header: afxwin.h

See Also

Reference

CWnd Class

Hierarchy Chart

CWnd::SetScrollPos

SetScrollRange

CWnd::GetScrollRange