CPropertySheet::Create

显示非模式属性表。

virtual BOOL Create(
   CWnd* pParentWnd = NULL,
   DWORD dwStyle = (DWORD)–1,
   DWORD dwExStyle = 0 
);

参数

  • pParentWnd
    点父窗口。 如果 NULL,父对象是桌面。

  • dwStyle
    属性表的窗口样式。 有关完整的可用样式,请参见 窗口样式

  • dwExStyle
    属性表的扩展窗口样式。 有关完整的可用样式,请参见 扩展窗口样式

返回值

非零,则属性表成功创建;否则为0。

备注

Create 的调用将在构造函数中,也可以通知它,构造函数调用之后。

默认样式,表示通过– 1作为 dwStyle,实际上是 WS_SYSMENU | WS_POPUP | WS_CAPTION | DS_MODALFRAME | DS_CONTEXTHELP | WS_VISIBLE。 默认扩展的窗口样式,表示通过将0作为 dwExStyle,实际上是 WS_EX_DLGMODALFRAME

Create 成员函数中创建属性表后返回。 若要销毁属性表,请调用 CWnd::DestroyWindow

无模式属性表显示的调用。Create 没有好,不取消,不适用现在和"帮助"按钮,所以模式属性表。 必须由用户创建所需按钮。

若要显示一个模式属性表,请调用 DoModal

示例

// This code fragment shows how to create a modeless property sheet 
// dialog in a command message handler (OnModelessPropertySheet()) 
// of a CView-derived class.
void CPSheetView::OnModelessPropertySheet()
{
   // Declare a CPropertySheet object.  m_pdlgPropertySheet is a data
   // member of type CPropertySheet in CView-derived class.
   m_pdlgPropertySheet = new CPropertySheet(_T("Simple PropertySheet"));
   ASSERT(m_pdlgPropertySheet);

   // Add three pages to the CPropertySheet object.  Both m_pstylePage, 
   // m_pcolorPage, and m_pshapePage are data members of type 
   // CPropertyPage-derived classes in CView-derived class.
   m_pstylePage = new CStylePage;
   m_pcolorPage = new CColorPage;
   m_pshapePage = new CShapePage;
   m_pdlgPropertySheet->AddPage(m_pstylePage);
   m_pdlgPropertySheet->AddPage(m_pcolorPage);
   m_pdlgPropertySheet->AddPage(m_pshapePage);

   // Create a modeless CPropertySheet dialog.
   m_pdlgPropertySheet->Create(); 
}
// The code fragment below shows how to destroy the C++ objects for
// propertysheet and propertypage in the destructor of CView-derived
// class.
// NOTE:  DestroyWindow() is called in CPropertySheet::OnClose() so
// you do not need to call it here.  Property pages are children
// of the CPropertySheet, they will be destroyed by their parents.
CPSheetView::~CPSheetView()
{
   delete m_pshapePage;
   delete m_pstylePage;
   delete m_pcolorPage;
   delete m_pdlgPropertySheet;
}

要求

Header: afxdlgs.h

请参见

参考

CPropertySheet选件类

层次结构图

CDialog::Create

CPropertySheet::DoModal