要点:1:先创建3个基于CPropertyPage类的属性页,并为其添加响应函数,onSetActive(),OnWizardNext()函数,添加如下代码:第二页中添加个复选框控件,并将其与m_check1关联将其初始化为false

BOOL CStep2::OnSetActive()
{
 CPropertySheet *pSheet=(CPropertySheet *)GetParent();
 ASSERT_KINDOF(CPropertySheet,pSheet);
 pSheet->SetWizardButtons(PSWIZB_NEXT|PSWIZB_BACK); 
 return CPropertyPage::OnSetActive();

}

LRESULT CStep2::OnWizardNext()
{
 UpdateData();
 if(!m_check)
 {
  MessageBox("You must check the box.");
  return -1;
 }

 return CPropertyPage::OnWizardNext();
}

2:创建个 基于CPropertySheet 类的属性表,添加3个属性页的变量,

在该类下的2个函数中增加代码:

CWizardSheet::CWizardSheet(UINT nIDCaption, CWnd* pParentWnd, UINT iSelectPage)
 :CPropertySheet(nIDCaption, pParentWnd, iSelectPage)
{//增加的代码
 AddPage(&m_step1);
 AddPage(&m_step2);
 AddPage(&m_step3);
}

CWizardSheet::CWizardSheet(LPCTSTR pszCaption, CWnd* pParentWnd, UINT iSelectPage)
 :CPropertySheet(pszCaption, pParentWnd, iSelectPage)
{//增加的代码
 AddPage(&m_step1);
 AddPage(&m_step2);
 AddPage(&m_step3);
}

在APP类里修改代码:

CWizardSheet dlg("Wizard Sheet");
 m_pMainWnd = &dlg;
 dlg.SetWizardMode( );
 int nResponse = dlg.DoModal();
 return FALSE;

 

这样就建好了……

posted on 2011-07-28 09:28  role  阅读(1428)  评论(0编辑  收藏  举报