countformview.cpp

来自「《MFC经典问答》pdf格式 拿出来大家共享一下」· C++ 代码 · 共 77 行

CPP
77
字号
// CountFormView.cpp : implementation file
//

#include "stdafx.h"
#include "TwoViews.h"

#include "CountFormView.h"
#include "CountDoc.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CCountFormView

IMPLEMENT_DYNCREATE(CCountFormView, CFormView)

CCountFormView::CCountFormView()
	: CFormView(CCountFormView::IDD)
{
	//{{AFX_DATA_INIT(CCountFormView)
	m_nCount = 0;
	//}}AFX_DATA_INIT
}

CCountFormView::~CCountFormView()
{
}

void CCountFormView::DoDataExchange(CDataExchange* pDX)
{
	CFormView::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CCountFormView)
	DDX_Text(pDX, IDC_COUNTER, m_nCount);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CCountFormView, CFormView)
	//{{AFX_MSG_MAP(CCountFormView)
		// NOTE - the ClassWizard will add and remove mapping macros here.
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CCountFormView diagnostics

#ifdef _DEBUG
void CCountFormView::AssertValid() const
{
	CFormView::AssertValid();
}

void CCountFormView::Dump(CDumpContext& dc) const
{
	CFormView::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CCountFormView message handlers

void CCountFormView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint) 
{
	// Get the current data from our document
	CCountDoc* pDoc = static_cast< CCountDoc* >( GetDocument() );
	ASSERT_KINDOF( CCountDoc, pDoc );

	m_nCount = pDoc->m_nCount;

	// Show the current data in our edit controls
	UpdateData( FALSE );
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?