CPagerCtrl::GetScrollPos

检索当前页导航控件的滚动位置。

int GetScrollPos() const;

要求

标头: afxcmn.h

返回值

当前滚动位置,则单位是像素。

备注

此方法发送 PGM_GETPOS 信息,在 Windows SDK所述。

示例

下面的示例使用 CPagerCtrl::GetScrollPos 方法检索页导航控件的当前滚动位置。 如果页导航控件尚未将为零,最左边的位置,该示例使用 CPagerCtrl::SetScrollPos 方法将滚动位置设置为零。

void CCSplitButton_s2Dlg::OnXScrollposition()
{
    int pos;
    CString str;
    pos = m_pager.GetScrollPos();
    if (pos != 0) 
        m_pager.SetScrollPos(0);
    str.Format(_T("Old position = %d; new position = 0"), pos);
    MessageBox(str);
}

请参见

参考

CPagerCtrl选件类

层次结构图

PGM_GETPOS

CPagerCtrl::SetScrollPos