⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 index106.htm

📁 一本不错的VC编程的参考书
💻 HTM
字号:
<html>
<style type="text/css"><!--
.p9 {  font-family: "宋体"; font-size: 9pt}a        {text-transform: none; text-decoration: none;}
a:hover {text-decoration: underline; color: #FF0000;}
--></style>
<body background="../di2001.jpg">
<h3 align="center"><font COLOR="#AOAO99"></font></h3>
<table width="100%" border="1" cellspacing="1">
<tr><td><p align="center"><font color="#FF0000">当文档被修改时,如何在标题上加上标志'*'?</font></td></tr>
<tr><td><p>
</Br>
重载CDocument类的虚函数virtual SetModifiedFlag:<Br>
</Br>
void CTest2Doc::SetModifiedFlag(BOOL bModified)<Br>
{<Br>
&nbsp;&nbsp;&nbsp;&nbsp;CString strTitle = GetTitle();<Br>
&nbsp;&nbsp;&nbsp;&nbsp;CString strDirtyFlag = " *"; // note space before the '*'<Br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// so we don't break Save As dialog<Br>
</Br>
&nbsp;&nbsp;&nbsp;&nbsp;if (!IsModified() && bModified)<Br>
&nbsp;&nbsp;&nbsp;&nbsp;{<Br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SetTitle(strTitle + strDirtyFlag);<Br>
&nbsp;&nbsp;&nbsp;&nbsp;}<Br>
&nbsp;&nbsp;&nbsp;&nbsp;else if ( IsModified() && !bModified )<Br>
&nbsp;&nbsp;&nbsp;&nbsp;{<Br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;int nTitleLength = strTitle.GetLength();<Br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;int nDirtyLength = strDirtyFlag.GetLength();<Br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SetTitle( strTitle.Left(nTitleLength - nDirtyLength) );<Br>
&nbsp;&nbsp;&nbsp;&nbsp;}<Br>
</Br>
&nbsp;&nbsp;&nbsp;&nbsp;UpdateFrameCounts();<Br>
</Br>
&nbsp;&nbsp;&nbsp;&nbsp;CDocument::SetModifiedFlag(bModified);<Br>
}<Br>
</Br>
</p></td></tr>
</table>
</body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -