Share via


CScrollBar::SetScrollInfo

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

Return Value

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

Parameters

lpScrollInfo

A pointer to a 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.

Remarks

Call this member function to set the information that the SCROLLINFO structure maintains about a scroll bar. 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 structure topic in the Win32 SDK Programmer’s Reference for more information about changing the structure defaults.

Example

// CMyView is a CView-derived class.
void CMyView::OnInitialUpdate()
{
   CView::OnInitialUpdate();

   // Set SCROLLINFO for the scroll bar. m_ScrollBar is of type
   // CScrollBar class, and it is a member variable in CMyView 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_ScrollBar.SetScrollInfo(&info);
}

CScrollBar OverviewClass MembersHierarchy Chart

See Also   CScrollBar::GetScrollInfo, CWnd::SetScrollInfo, CWnd::SetScrollPos, CWnd::OnVScroll, CWnd::OnHScroll, CWnd::GetScrollInfo,