CPagerCtrl::GetScrollPos

Retrieves the scroll position of the current pager control.

int GetScrollPos() const;

Requirements

Header: afxcmn.h

Return Value

The current scroll position, measured in pixels.

Remarks

This method sends the PGM_GETPOS message, which is described in the Windows SDK.

Example

The following example uses the CPagerCtrl::GetScrollPos method to retrieve the current scroll position of the pager control. If the pager control is not already scrolled to zero, the leftmost position, the example uses the CPagerCtrl::SetScrollPos method to set the scroll position to zero.

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);
}

See Also

Concepts

CPagerCtrl Class

CPagerCtrl Members

Hierarchy Chart

PGM_GETPOS

CPagerCtrl::SetScrollPos