📄 filemodinotifydoc.cpp
字号:
// FileModiNotifyDoc.cpp : implementation of the CFileModiNotifyDoc class
//
#include "stdafx.h"
#include "FileModiNotify.h"
#include "FileModiNotifyDoc.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CFileModiNotifyDoc
IMPLEMENT_DYNCREATE(CFileModiNotifyDoc, CDocument)
BEGIN_MESSAGE_MAP(CFileModiNotifyDoc, CDocument)
//{{AFX_MSG_MAP(CFileModiNotifyDoc)
// 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()
/////////////////////////////////////////////////////////////////////////////
// CFileModiNotifyDoc construction/destruction
CFileModiNotifyDoc::CFileModiNotifyDoc()
{
// TODO: add one-time construction code here
}
CFileModiNotifyDoc::~CFileModiNotifyDoc()
{
}
BOOL CFileModiNotifyDoc::OnNewDocument()
{
if (!CDocument::OnNewDocument())
return FALSE;
// TODO: add reinitialization code here
// (SDI documents will reuse this document)
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CFileModiNotifyDoc serialization
void CFileModiNotifyDoc::Serialize(CArchive& ar)
{
if (ar.IsStoring())
{
// TODO: add storing code here
}
else
{
// TODO: add loading code here
}
}
/////////////////////////////////////////////////////////////////////////////
// CFileModiNotifyDoc diagnostics
#ifdef _DEBUG
void CFileModiNotifyDoc::AssertValid() const
{
CDocument::AssertValid();
}
void CFileModiNotifyDoc::Dump(CDumpContext& dc) const
{
CDocument::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CFileModiNotifyDoc commands
BOOL CFileModiNotifyDoc::SaveModified()
{
// TODO: Add your specialized code here and/or call the base class
return CDocument::SaveModified();
}
void CFileModiNotifyDoc::SetModifiedFlag(BOOL bModified)
{
CString strTitle = GetTitle();
CString strDirtyFlag = " 文件(文档)已被修改,注意保存喔!";
//注意引号内前面的空格!
//如果不要引号内前面的空格,save as保存文件对话框中的文件名后会带*号!
//假如被修改了
if (!IsModified() && bModified)
{
//标题栏也修改
SetTitle(strTitle + strDirtyFlag);
}
else if ( IsModified() && !bModified )
{
int nTitleLength = strTitle.GetLength();
int nDirtyLength = strDirtyFlag.GetLength();
SetTitle( strTitle.Left(nTitleLength - nDirtyLength) );
}
UpdateFrameCounts();
CDocument::SetModifiedFlag(bModified);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -