📄 myeditdoc.cpp
字号:
// MyEditDoc.cpp : implementation of the CMyEditDoc class
//
#include "stdafx.h"
#include "VCEditDemo.h"
#include "MyEditDoc.h"
#include "MyEditView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMyEditDoc
IMPLEMENT_DYNCREATE(CMyEditDoc, CDocument)
BEGIN_MESSAGE_MAP(CMyEditDoc, CDocument)
//{{AFX_MSG_MAP(CMyEditDoc)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMyEditDoc construction/destruction
CMyEditDoc::CMyEditDoc()
{
// TODO: add one-time construction code here
}
CMyEditDoc::~CMyEditDoc()
{
}
BOOL CMyEditDoc::OnNewDocument()
{
if (!CDocument::OnNewDocument())
return FALSE;
// TODO: add reinitialization code here
// (SDI documents will reuse this document)
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CMyEditDoc serialization
void CMyEditDoc::Serialize(CArchive& ar)
{
if (ar.IsStoring())
{
// TODO: add storing code here
}
else
{
// TODO: add loading code here
}
}
/////////////////////////////////////////////////////////////////////////////
// CMyEditDoc diagnostics
#ifdef _DEBUG
void CMyEditDoc::AssertValid() const
{
CDocument::AssertValid();
}
void CMyEditDoc::Dump(CDumpContext& dc) const
{
CDocument::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CMyEditDoc commands
//判断窗口能否安全关闭,此时进行关闭工作区等工作
BOOL CMyEditDoc::CanCloseFrame(CFrameWnd* pFrame)
{
short rtn=1;
CMyEditView* EditView;
POSITION pos = GetFirstViewPosition();
while (pos != NULL)
{
CView* pView = GetNextView(pos);
CRuntimeClass* pRClass = pView->GetRuntimeClass();
if(!strcmp(pRClass->m_lpszClassName,"CMyEditView"))
{
EditView = (CMyEditView*)pView;
rtn = rtn && EditView->CanClose();
}
}
//返回值:0--不关闭框架(按下"取消")
//返回值:1--关闭框架
//return CDocument::CanCloseFrame(pFrame);
return rtn;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -