CPropertyPage::OnCancel

更新 : 2007 年 11 月

[キャンセル] ボタンがクリックされたときに、フレームワークが呼び出します。

virtual void OnCancel( );

解説

[キャンセル] ボタンの動作を実行するときはこのメンバ関数をオーバーライドします。既定では、実行された変更をすべて無効にします。

使用例

// Discard any selection the user made to this page.  The object
// in the view will be painted with the initial color when the
// CPropertySheet dialog is first shown. CColorPage is a 
// CPropertyPage-derived class.
void CColorPage::OnCancel() 
{
   // Reset the color saved in the document class.  m_InitialColor
   // is a member variable of CColorPage and it is the color shown 
   // in the view before CPropertySheet is shown.
   // doc->m_Color is the color saved in the document class, and 
   // this is the color to be used by the view class.
   CMDIFrameWnd* pFrame = (CMDIFrameWnd*) AfxGetMainWnd();
   CMDIChildWnd* pChild = pFrame->MDIGetActive();
   CPSheetDoc* doc = (CPSheetDoc*) pChild->GetActiveDocument();
   doc->m_Color = m_InitialColor;

   // Tell the view to paint with the initial color.
   CView* view = pChild->GetActiveView();
   view->Invalidate();

   CPropertyPage::OnCancel();
}

// The default MFC implementation of OnReset() would call OnCancel().
void CColorPage::OnReset() 
{
   CPropertyPage::OnReset();
}

必要条件

ヘッダー : afxdlgs.h

参照

参照

CPropertyPage クラス

階層図

CPropertyPage::OnApply

CDialog::OnCancel

CPropertyPage::OnOK

その他の技術情報

CPropertyPage のメンバ