CPropertyPage::Construct

调用该成员函数的构造 CPropertyPage 对象。

void Construct(
   UINT nIDTemplate,
   UINT nIDCaption = 0 
);
void Construct(
   LPCTSTR lpszTemplateName,
   UINT nIDCaption = 0 
);
void Construct(
   UINT nIDTemplate,
   UINT nIDCaption,
   UINT nIDHeaderTitle,
   UINT nIDHeaderSubTitle = 0 
);
void Construct(
   LPCTSTR lpszTemplateName,
   UINT nIDCaption,
   UINT nIDHeaderTitle,
   UINT nIDHeaderSubTitle = 0 
);

参数

  • nIDTemplate
    本页模板的ID。

  • nIDCaption
    此页上的选项将会将名称的ID。如果为 0,则名称在此页中的对话框模板要执行。

  • lpszTemplateName
    包含是模板资源的名称为Null终止的字符串。

  • nIDHeaderTitle
    在属性页标头的标题位置上的名称的ID。默认情况下,0。

  • nIDHeaderSubTitle
    在属性页标头的子标题位置上的名称的ID。默认情况下,0。

备注

在满足以下条件后,对象显示:

如果其他选件类构造函数之一未调用,请调用 Construct 。因为您在代码中,可以保留参数语句空白随时然后指定多个参数和构造 Construct 成员函数很灵活。

必须使用 Construct,将数组时,因此,您必须调用该数组的每个成员的 Construct ,以便数据成员分配适当的值。

示例

// Declare a CPropertySheet object.
CPropertySheet sheet(_T("Simple PropertySheet"));

// Create three CPropertyPage objects whose template IDs are specified
// in rgID array, and add each page to the CPropertySheet object. 
const int c_cPages = 3;
CPropertyPage   pages[c_cPages];
UINT rgID[c_cPages] = {IDD_STYLE, IDD_COLOR, IDD_SHAPE};
for (int i = 0; i < c_cPages; i++)    
{
   pages[i].Construct(rgID[i]);
   sheet.AddPage(&pages[i]);
}

// Display a modal CPropertySheet dialog.
sheet.DoModal();

要求

Header: afxdlgs.h

请参见

参考

CPropertyPage选件类

层次结构图

CPropertyPage::CPropertyPage

CPropertySheet::DoModal

CPropertySheet::AddPage