📄 rj050119doc.cpp
字号:
// RJ050119Doc.cpp : implementation of the CRJ050119Doc class
//
#include "stdafx.h"
#include "RJ050119.h"
#include "RJ050119Doc.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CRJ050119Doc
IMPLEMENT_DYNCREATE(CRJ050119Doc, CDocument)
BEGIN_MESSAGE_MAP(CRJ050119Doc, CDocument)
//{{AFX_MSG_MAP(CRJ050119Doc)
ON_COMMAND(ID_COIN_ADD, OnCoinAdd)
ON_COMMAND(ID_COIN_SUB, OnCoinSub)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CRJ050119Doc construction/destruction
CRJ050119Doc::CRJ050119Doc()
{
// TODO: add one-time construction code here
}
CRJ050119Doc::~CRJ050119Doc()
{
}
BOOL CRJ050119Doc::OnNewDocument()
{
if (!CDocument::OnNewDocument())
return FALSE;
// TODO: add reinitialization code here
// (SDI documents will reuse this document)
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CRJ050119Doc serialization
void CRJ050119Doc::Serialize(CArchive& ar)
{
if (ar.IsStoring())
{
// TODO: add storing code here
ar<<m_nCoins; //保存硬币数量
}
else
{
// TODO: add loading code here
ar>>m_nCoins; //读取硬币数量
}
}
/////////////////////////////////////////////////////////////////////////////
// CRJ050119Doc diagnostics
#ifdef _DEBUG
void CRJ050119Doc::AssertValid() const
{
CDocument::AssertValid();
}
void CRJ050119Doc::Dump(CDumpContext& dc) const
{
CDocument::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CRJ050119Doc commands
void CRJ050119Doc::DeleteContents()
{
// TODO: Add your specialized code here and/or call the base class
m_nCoins=1; //初始化成员变量
CDocument::DeleteContents();
}
void CRJ050119Doc::OnCoinAdd()
{
// TODO: Add your command handler code here
m_nCoins++; //硬币数量加1
UpdateAllViews(NULL); //刷新视图
}
void CRJ050119Doc::OnCoinSub()
{
// TODO: Add your command handler code here
if(m_nCoins>0) m_nCoins--; //硬币数量减1
UpdateAllViews(NULL); //刷新视图
}
//DEL void CRJ050119Doc::OnColor()
//DEL {
//DEL // TODO: Add your command handler code here
//DEL
//DEL }
//DEL void CRJ050119Doc::OnUpdateColor(CCmdUI* pCmdUI)
//DEL {
//DEL // TODO: Add your command update UI handler code here
//DEL
//DEL }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -