📄 rj030413doc.cpp
字号:
// RJ030413Doc.cpp : implementation of the CRJ030413Doc class
//
#include "stdafx.h"
#include "RJ030413.h"
#include "RJ030413Doc.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CRJ030413Doc
IMPLEMENT_DYNCREATE(CRJ030413Doc, CDocument)
BEGIN_MESSAGE_MAP(CRJ030413Doc, CDocument)
//{{AFX_MSG_MAP(CRJ030413Doc)
ON_COMMAND(ID_COIN_ADD, OnCoinAdd)
ON_COMMAND(ID_COIN_SUB, OnCoinSub)
ON_UPDATE_COMMAND_UI(ID_COIN_SUB, OnUpdateCoinSub)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CRJ030413Doc construction/destruction
CRJ030413Doc::CRJ030413Doc()
{
// TODO: add one-time construction code here
}
CRJ030413Doc::~CRJ030413Doc()
{
}
BOOL CRJ030413Doc::OnNewDocument()
{
if (!CDocument::OnNewDocument())
return FALSE;
// TODO: add reinitialization code here
// (SDI documents will reuse this document)
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CRJ030413Doc serialization
void CRJ030413Doc::Serialize(CArchive& ar)
{
if (ar.IsStoring())
{
// TODO: add storing code here
}
else
{
// TODO: add loading code here
}
}
/////////////////////////////////////////////////////////////////////////////
// CRJ030413Doc diagnostics
#ifdef _DEBUG
void CRJ030413Doc::AssertValid() const
{
CDocument::AssertValid();
}
void CRJ030413Doc::Dump(CDumpContext& dc) const
{
CDocument::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CRJ030413Doc commands
void CRJ030413Doc::DeleteContents()
{
// TODO: Add your specialized code here and/or call the base class
//。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。
m_nCoins=0;
//。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。
CDocument::DeleteContents();
}
void CRJ030413Doc::OnCoinAdd()
{
// TODO: Add your command handler code here
//...................................................................
m_nCoins++;
UpdateAllViews(NULL);
//...................................................................
}
void CRJ030413Doc::OnCoinSub()
{
// TODO: Add your command handler code here
//...................................................................
if(m_nCoins>0)
m_nCoins--;
UpdateAllViews(NULL);
//...................................................................
}
void CRJ030413Doc::OnUpdateCoinSub(CCmdUI* pCmdUI)
{
// TODO: Add your command update UI handler code here
//.....................................................................
if(m_nCoins<1)
pCmdUI->Enable(FALSE);
else
pCmdUI->Enable(TRUE);
//......................................................................
}
//.........................................................................
void CRJ030413Doc::AddLine(CPoint pt1,CPoint pt2)
{
CLine * pLine=new CLine(pt1,pt2);
m_LineArray.Add(pLine);
}
CLine* CRJ030413Doc::GetLine(int nIndex)
{
if(nIndex<0||nIndex>m_LineArray.GetUpperBound())
return NULL;
return m_LineArray.GetAt(nIndex);
}
int CRJ030413Doc::GetNumLines()
{
return m_LineArray.GetSize();
}
//.........................................................................
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -