关于属性页和属性单的应用总结
1、属性页(CPropertyPage)中获取
(1) 程序主框架指针:CMainFrame* pMainFrame=(CMainFrame*)AfxGetMainWnd();
(2) 程序子框架指针:CChildFrame* pframe=(CChildFrame*)((CMainFrame*)AfxGetMainWnd())->GetActiveFrame();
(3) 程序活动文档指针:CEMCDoc* m_pDoc=(CEMCDoc*)pframe->GetActiveDocument(); //获取活动的文档
(4) 属性单(CPropertySheet)指针:CMyPropertySheet* pSheet=(CMyPropertySheet*)this->GetParent(); // 获取CMyPropertySheet指针
(5) 程序活动视图指针:CEMCView* pView=(CEMCView*)pframe->GetActiveView(); // 获取活动视图
2、在属性单(CPropertySheet)单击OK按钮后,程序框架将逐个遍历加载的CPropertyPage(从GetPage(0)~GetPage(N-1)),查询是否
有CPropertyPage重载了OnOK(),若有则执行重载的代码,否则执行默认的CPropertyPage::OnOK()。
3、CPropertySheet和加载的CPropertyPage通信,可以在CPropertySheet中定义
CPPageContentMode* pCM=(CPPageContentMode*)this->GetPage(0);
然后利用pCM操作CPPageContentMode中的成员变量。
也可以在CPropertyPage中获取CPropertySheet的指针。
4、两个或多个加载的CPropertyPage之间通信,可以借助于CPropertySheet实现。
5、对CPropertySheet标准按钮的操作
(1)更改标准按钮的标题:
CWnd* pWnd=GetDlgItem(IDOK);
pWnd->SetWindowTextW(_T("开始"));
(2)去掉“应用”按钮:
pWnd=GetDlgItem(ID_APPLY_NOW);
pWnd->ShowWindow(FALSE);
(3)移动标准按钮至对话框中间






















