📄 countdoc.cpp
字号:
// CountDoc.cpp : implementation file
//
#include "stdafx.h"
#include "AutoSaveDoc.h"
#include "CountDoc.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CCountDoc
IMPLEMENT_DYNCREATE(CCountDoc, CDocument)
CCountDoc::CCountDoc()
{
m_nCount = 0;
}
BOOL CCountDoc::OnNewDocument()
{
if (!CDocument::OnNewDocument())
return FALSE;
return TRUE;
}
CCountDoc::~CCountDoc()
{
}
BEGIN_MESSAGE_MAP(CCountDoc, CDocument)
//{{AFX_MSG_MAP(CCountDoc)
ON_COMMAND(ID_COUNT_INCREMENT, OnCountIncrement)
ON_COMMAND(ID_COUNT_DECREMENT, OnCountDecrement)
ON_COMMAND(ID_COUNT_RESET, OnCountReset)
ON_UPDATE_COMMAND_UI(ID_COUNT_RESET, OnUpdateCountReset)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CCountDoc diagnostics
#ifdef _DEBUG
void CCountDoc::AssertValid() const
{
CDocument::AssertValid();
}
void CCountDoc::Dump(CDumpContext& dc) const
{
CDocument::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CCountDoc serialization
void CCountDoc::Serialize(CArchive& ar)
{
if (ar.IsStoring())
{
ar << (WORD) m_nCount;
}
else
{
ar >> (WORD&) m_nCount;
}
}
/////////////////////////////////////////////////////////////////////////////
// CCountDoc commands
void CCountDoc::OnCountIncrement()
{
++m_nCount;
UpdateAllViews( NULL );
SetModifiedFlag( TRUE );
}
void CCountDoc::OnCountDecrement()
{
--m_nCount;
UpdateAllViews( NULL );
SetModifiedFlag( TRUE );
}
void CCountDoc::OnCountReset()
{
m_nCount = 0;
UpdateAllViews( NULL );
SetModifiedFlag( TRUE );
}
void CCountDoc::OnUpdateCountReset(CCmdUI* pCmdUI)
{
pCmdUI->Enable( m_nCount != 0 );
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -