我在属性页中进行一些设置,希望在没有设置完成以前,按确定按钮不退出。在CPropertySheet和CPropertyPage中都没有可用的信息。希望高手赐教!谢谢

解决方案 »

  1.   

    CPropertyPage只有OnOK()没有OnCliekedOK(),而且也不能阻止属性页的关闭,我本以为跳过不执行CPropertyPage::OnOK()就可以,可是不行。
      

  2.   

    onokExample
    // Accept the new color selection and dismiss the CPropertySheet
    // dialog. The view's object will be painted with the new selected
    // color. CColorPage is a CPropertyPage-derived class.
    void CColorPage::OnOK() 
    {
       // Store the new selected color to a member variable of 
       // document class.  m_Color is a member varible of CColorPage 
       // and it stores the new selected color.  doc->m_Color is 
       // the color saved in the document class and it is the color 
       // used by the view class.
       CFrameWnd* frame = (CFrameWnd*) AfxGetMainWnd();
       CPSheetDoc* doc = (CPSheetDoc*) frame->GetActiveDocument();
       doc->m_Color = m_Color;   // Tell the view to paint with the new selected color.
       CView* view = frame->GetActiveView();
       view->Invalidate();
      
       CPropertyPage::OnOK();
    }// The default MFC implementation of OnApply() would call OnOK().
    BOOL CColorPage::OnApply() 
    {
       return CPropertyPage::OnApply();
    }
      

  3.   

    把CPropertyPage::OnOK();去掉,换成return FALSE;
      

  4.   

    我也本以为跳过不执行CPropertyPage::OnOK()就可以,可是不行。另:是 void CPropertyPage::OnOK(),没有返回值的。
      

  5.   

    重载OnApply,返回false阻止CPropertySheet关闭。
      

  6.   

    将确定按钮从属性页上去掉.
    GetDlgItem(IDOK)->ShowWindow(SW_HIDE   )