CScrollBar::SetScrollRange

設定指定捲軸的最小和最大位置值。

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

參數

  • nMinPos
    指定最小捲動位置。

  • nMaxPos
    指定最大捲動位置。

  • bRedraw
    指定是否應該重新繪製捲軸會反映這些變更。 如果 bRedraw 是 ,捲軸重新繪製,如果 ,就不會重新繪製。 預設會重繪。

備註

設定 nMinPos 和 nMaxPos 到 0 隱藏標準捲軸。

請不要呼叫這個函式已被隱藏捲軸,當處理捲軸通知訊息時。

如果為 SetScrollRange 的呼叫後面緊接著呼叫 SetScrollPos 成員函式,請將 SetScrollPos 的 bRedraw 到 0 可防止捲軸兩次重繪。

在 nMinPos 指定的值和 nMaxPos 之間的差異小於 32,767 不能大於。 捲軸控制項的預設範圍是空的 ( nMinPos 和 nMaxPos 為 0)。

範例

// Sets minimum (0) and maximum (10) position values for the
// CScrollBar control. m_ScrollBarVert is of type CScrollBar class, 
// and it is a member variable in CMyDialog class.
m_ScrollBarVert.SetScrollRange(0, 10);

// Set the position of the scroll box.
m_ScrollBarVert.SetScrollPos(5);

// Disable the down arrow of the scroll bar. By default, both arrows 
// are enabled.
m_ScrollBarVert.EnableScrollBar(ESB_DISABLE_DOWN);

需求

Header: afxwin.h

請參閱

參考

CScrollBar 類別

階層架構圖

CScrollBar::GetScrollPos

CScrollBar::SetScrollPos

CScrollBar::GetScrollRange

SetScrollRange