CPagerCtrl::SetChild

设置当前页导航控件所包含的窗口。

void SetChild(
     HWND hwndChild
);

参数

Parameter

说明

[in] hwndChild

句柄将包含的窗口。

要求

标头: afxcmn.h

备注

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

此方法不更改包含的窗口的父;它只分布窗口句柄页导航控件提供滚动。 在许多情况下,包含的窗口将是页导航控件的子窗口。

示例

下面的示例创建一个页导航控件,然后使用 CPagerCtrl::SetChild 方法创建一个很长的按钮控件与页导航控件。 然后该示例使用 CPagerCtrl::SetButtonSize 方法设置页导航控件的高度为20像素、 CPagerCtrl::SetBorder 方法设置边框粗细为1像素。

    // Initialize the dropdown menu of the splitbutton control.
    m_splitButton.SetDropDownMenu(IDR_MENU1, 0);

    // Create the pager control.
    BOOL nRet;
    CRect rect;
    GetClientRect(&rect);
    nRet = m_pager.Create(
        (WS_VISIBLE | WS_CHILD | PGS_HORZ),
        CRect(rect.Width()/4, 5, (rect.Width() * 3)/4, 55),
        this,
        IDC_PAGER1); 

    m_pager.GetClientRect( &rect );
    nRet = m_button.Create(
        _T("This is a very, very long button. 012345678901234567890"), 
        (WS_VISIBLE | WS_CHILD), // Do not use CCS_NORESIZE.
        CRect(0,0,rect.Width(),30), 
        &m_pager, IDC_BUTTON1);

    m_pager.SetChild(m_button.m_hWnd);
    m_pager.SetButtonSize( 20 );
    m_pager.SetBorder( 1 );

请参见

参考

CPagerCtrl选件类

层次结构图