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

📄 index023.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>
调用CWnd : : SetWindowText可以改变任何窗口(包括控件)的标题。<Br>
//Set title for application's main frame window .<Br>
AfxGetMainWnd ( ) —> SetWindowText (_T("Application title") )<Br>
</Br>
//Set title for View's MDI child frame window .<Br>
GetParentFrame ( ) —> SetWindowText ("_T ("MDI Child Frame new title")<Br>
)<Br>
</Br>
//Set title for dialog's push button control.<Br>
GetDigitem (IDC_BUTTON) —> SetWindowText (_T ("Button new title ") )<Br>
如果需要经常修改窗口的标题(注:控件也是窗口),应该考虑使用半文档化的函数AfxSetWindowText。该函数在AFXPRIV.H中说明,在WINUTIL.CPP中实现,在联机帮助中找不到它,它在AFXPRIV.H中半文档化, 在以后发行的MFC中将文档化。<Br>
AfxSetWindowText的实现如下:<Br>
voik AFXAPI AfxSetWindowText (HWND hWndCtrl , LPCTSTR IpszNew )<Br>
{<Br>
&nbsp;itn nNewLen= Istrlen (Ipaznew)<Br>
&nbsp;TCHAR szOld [256]<Br>
&nbsp;//fast check to see if text really changes (reduces<Br>
flash in the<Br>
controls )<Br>
&nbsp;if (nNewLen >_contof (szOld)<Br>
|| : : GetWindowText (hWndCrtl, szOld , _countof (szOld) !=nNewLen<Br>
|| Istrcmp (szOld , IpszNew)! = 0<Br>
{<Br>
&nbsp;//change it<Br>
&nbsp;: : SetWindowText(hWndCtrl , IpszNew )<Br>
&nbsp;}<Br>
}<Br>
</Br>
</p></td></tr>
</table>
</body></html>

⌨️ 快捷键说明

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