⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mdicoindoc.cpp

📁 本光盘包含的是《实用Visual C++ 6.0教程》一书中所有程序的代码
💻 CPP
字号:
// MDICoinDoc.cpp : implementation of the CMDICoinDoc class
//

#include "stdafx.h"
#include "MDICoin.h"

#include "MDICoinDoc.h"

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

/////////////////////////////////////////////////////////////////////////////
// CMDICoinDoc

IMPLEMENT_DYNCREATE(CMDICoinDoc, CDocument)

BEGIN_MESSAGE_MAP(CMDICoinDoc, CDocument)
	//{{AFX_MSG_MAP(CMDICoinDoc)
	ON_COMMAND(ID_EDIT_ADD_COIN, OnEditAddCoin)
	ON_COMMAND(ID_EDIT_REMOVE_COIN, OnEditRemoveCoin)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMDICoinDoc construction/destruction

CMDICoinDoc::CMDICoinDoc()
{
	// TODO: add one-time construction code here
	m_nCoins = 1;

}

CMDICoinDoc::~CMDICoinDoc()
{
}

BOOL CMDICoinDoc::OnNewDocument()
{
	if (!CDocument::OnNewDocument())
		return FALSE;

	// TODO: add reinitialization code here
	// (SDI documents will reuse this document)

	return TRUE;
}



/////////////////////////////////////////////////////////////////////////////
// CMDICoinDoc serialization

void CMDICoinDoc::Serialize(CArchive& ar)
{
	if (ar.IsStoring())
	{
		// TODO: add storing code here
	}
	else
	{
		// TODO: add loading code here
	}
}

/////////////////////////////////////////////////////////////////////////////
// CMDICoinDoc diagnostics

#ifdef _DEBUG
void CMDICoinDoc::AssertValid() const
{
	CDocument::AssertValid();
}

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

/////////////////////////////////////////////////////////////////////////////
// CMDICoinDoc commands

int CMDICoinDoc::GetCoinCount()
{
	return m_nCoins;

}

void CMDICoinDoc::OnEditAddCoin() 
{
	// TODO: Add your command handler code here
	m_nCoins++;
	UpdateAllViews(NULL );
	
}

void CMDICoinDoc::OnEditRemoveCoin() 
{
	// TODO: Add your command handler code here
	if (m_nCoins > 0)
		m_nCoins--;
	UpdateAllViews( NULL);
	
}

⌨️ 快捷键说明

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