CPropertyPage::OnOK

此成员函数由框架调用,当用户选择或"时或应用现在,按,框架调用 OnKillActive之后。

virtual void OnOK( );

备注

当用户选择或"时或应用现在按,框架接收从属性页的 PSN_APPLY 通知。 为 OnOK 的调用不会调用,如果调用 CPropertySheet::PressButton,因为属性页不发送该用例的通知。

当用户关闭整个属性表时,请重写该成员函数的实现进一步的行为特定至此活动工作表。

该成员函数的默认实现指示页“无变动”反射分析该数据以 OnKillActive 函数中更新为止。

示例

// 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.
   CMDIFrameWnd* pframe = (CMDIFrameWnd*) AfxGetMainWnd();
   CMDIChildWnd* pchild = pframe->MDIGetActive();
   CPSheetDoc* doc = (CPSheetDoc*) pchild->GetActiveDocument();
   doc->m_Color = m_Color;

   // Tell the view to paint with the new selected color.
   CView* view = pchild->GetActiveView();
   view->Invalidate();

   CPropertyPage::OnOK();
}

// The default MFC implementation of OnApply() would call OnOK().
BOOL CColorPage::OnApply() 
{
   return CPropertyPage::OnApply();
}

要求

Header: afxdlgs.h

请参见

参考

CPropertyPage选件类

层次结构图

CDialog::OnOK

CPropertyPage::OnKillActive