Partager via


CScrollBar::SetScrollInfo

Sets the information that the SCROLLINFO structure maintains about a scroll bar.

BOOL SetScrollInfo(
   LPSCROLLINFO lpScrollInfo,
   BOOL bRedraw = TRUE 
);

Parameters

  • lpScrollInfo
    A pointer to a SCROLLINFO structure.

  • bRedraw
    Specifies whether the scroll bar should be redrawn to reflect the new information. 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

If successful, the return is TRUE. Otherwise, it is FALSE.

Remarks

You must provide the values required by the SCROLLINFO structure parameters, including the flag values.

The SCROLLINFO structure contains information about a scroll bar, including the minimum and maximum scrolling positions, the page size, and the position of the scroll box (the thumb). See the SCROLLINFO structure topic in the Windows SDK for more information about changing the structure defaults.

Example

// Set SCROLLINFO for the scroll bar. m_ScrollBarHorz is of type 
// CScrollBar class, and it is a member variable in CMyDialog class.
SCROLLINFO info;
info.cbSize = sizeof(SCROLLINFO);     
info.fMask = SIF_ALL;     
info.nMin = 0;     
info.nMax = 10; 
info.nPage = 2;     
info.nPos = 5;    
info.nTrackPos = 2; 
m_ScrollBarHorz.SetScrollInfo(&info);

Requirements

Header: afxwin.h

See Also

Concepts

CScrollBar Class

CScrollBar Members

Hierarchy Chart

CScrollBar::GetScrollInfo

CWnd::SetScrollInfo

CWnd::SetScrollPos

CWnd::OnVScroll

CWnd::OnHScroll

CWnd::GetScrollInfo

SCROLLINFO