Udostępnij za pośrednictwem


CPropertySheet::Construct

Constructs a CPropertySheet object.

void Construct(
   UINT nIDCaption,
   CWnd* pParentWnd = NULL,
   UINT iSelectPage = 0 
);
void Construct(
   LPCTSTR pszCaption,
   CWnd* pParentWnd = NULL,
   UINT iSelectPage = 0 
);
void Construct(
   UINT nIDCaption,
   CWnd* pParentWnd,
   UINT iSelectPage,
   HBITMAP hbmWatermark,
   HPALETTE hpalWatermark = NULL,
   HBITMAP hbmHeader = NULL 
);
void Construct(
   LPCTSTR pszCaption,
   CWnd* pParentWnd,
   UINT iSelectPage,
   HBITMAP hbmWatermark,
   HPALETTE hpalWatermark = NULL,
   HBITMAP hbmHeader = NULL 
);

Parameters

  • nIDCaption
    ID of the caption to be used for the property sheet.

  • pParentWnd
    Pointer to the parent window of the property sheet. If NULL, the parent window will be the main window of the application.

  • iSelectPage
    The index of the page that will initially be on top. Default is the first page added to the sheet.

  • pszCaption
    Pointer to a string containing the caption to be used for the property sheet. Cannot be NULL.

  • hbmWatermark
    Handle to the watermark bitmap of the property page.

  • hpalWatermark
    Handle to the palette of the watermark bitmap and/or header bitmap.

  • hbmHeader
    Handle to the header bitmap of the property page.

Remarks

Call this member function if one of the class constructors has not already been called. For example, call Construct when you declare or allocate arrays of CPropertySheet objects. In the case of arrays, you must call Construct for each member in the array.

To display the property sheet, call DoModal or Create. The string contained in the first parameter will be placed in the caption bar for the property sheet.

You can display watermark and/or header images automatically if you use the third or fourth prototypes of Construct, listed above, and you pass valid values for the hbmWatermark, hpalWatermark, and/or hbmHeader parameters.

Example

The following example demonstrates under what circumstances you would call Construct.

const int c_cSheets = 3;
CPropertySheet   grpropsheet[c_cSheets];
// no need to call Construct for this next one
CPropertySheet   someSheet(_T("Some sheet"));

LPTSTR rgszSheets[c_cSheets] = {
   _T("Sheet 1"),
   _T("Sheet 2"),
   _T("Sheet 3")
};

for (int i = 0; i < c_cSheets; i++)
    grpropsheet[i].Construct(rgszSheets[i]);

Requirements

Header: afxdlgs.h

See Also

Reference

CPropertySheet Class

Hierarchy Chart

CPropertySheet::CPropertySheet

CPropertySheet::DoModal

CPropertySheet::Create

Other Resources

CPropertySheet Members