Mfc 如何在propertysheet中完成初始化?

Mfc 如何在propertysheet中完成初始化?,mfc,Mfc,我有一个propertysheet,我在CPPropertySheet派生类中重写了OnInitDialog 如下: BOOL CMySheet::OnInitDialog() { CPropertySheet::OnInitDialog(); //Once the call reached this point and after this my first page OnInitDialog is being called. //Only first page onInitDialog

我有一个propertysheet,我在CPPropertySheet派生类中重写了OnInitDialog 如下:

BOOL CMySheet::OnInitDialog()
{
  CPropertySheet::OnInitDialog();
 //Once the call reached this point and after this my first page OnInitDialog is being called.
//Only first page onInitDialog is being called and it is not calling the remaining pages     //OnInitDialog.why?
//I am not sure how this calling or mapping is being done.

}
//CMySheet源自CPropertySheet


谁能解释一下所有这些映射是如何完成的。

如何正确添加页面: 您可以将a作为对话框容器来设计,因此它的主要任务是包含其他对话框。 首先,我要说的是,你必须创建你的s:那么,创建资源、类等等。。。 然后使用方法添加页面,但不必在中进行,也可以在构造函数中甚至在类外部进行,但重要的是在调用之前进行,因为此时将调用

大概是这样的:

CMySheet *pSheet = new CMySheet();
CMyPage *pPage = new CMyPage();
pSheet->AddPage(pPage);
INT_PTR iReturn = pSheet.DoModal();
东西是如何工作的:
在您使用该方法之后,将调用,然后将加载第一个页面,因为正如我所说的,它是一个对话框容器,因此它将一次显示一个对话框,这就是为什么您只看到第一个页面加载,因为一次只显示一个!因此,每个页面都将分别加载,比如当您单击存储页面的树时,或者如果您创建了向导,则当您单击“下一步”按钮时,而且不是同时全部

谢谢您的回复。在CPPropertySheet::OnInitDialog调用后,它将进入OnInitDialog的第一页,然后再次返回。我的疑问是,为什么它只进入OnInitDialog()的第一页,为什么不进入OnInitDialog()的其他页。这是我的疑问。哦,好的!我现在知道了,到时候我会修改我的答案!不用客气,我们都会遇到这样的问题的