📄 index036.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="../../../backg.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: : SetFont指定新字体。该函数用一个Cfont指针,要保证在控件撤消之前不能撤消字体对象。下例将下压按钮的字体改为8点Arial字体:<Br>
//Declare font object in class declaration (.H file ).<Br>
private : Cfont m_font<Br>
// Set font in class implementation (.Cpp file ). Note m_wndButton is a<Br>
//member variable added by ClassWizard.DDX routines hook the member<Br>
//variable to a dialog button contrlo.<Br>
BOOL CSampleDialog : : OnInitDialog ( )<Br>
{<Br>
…<Br>
//Create an 8-point Arial font<Br>
m_font . CreateFont (MulDiv (8 , -pDC<Br>
—> GetDeviceCaps(LOGPIXELSY) ,72). 0 , 0 , 0 , FW_NORMAL , 0 , 0,0, ANSI_CHARSER, OUT_STROKE_PRECIS ,<Br>
</Br>
CLIP_STROKE _PRECIS , DRAFT _QUALITY<Br>
VARIABLE_PITCH |FF_SWISS, _T("Arial") )<Br>
</Br>
//Set font for push button .<Br>
m_wndButton . SetFont (&m _font )<Br>
</Br>
…<Br>
}<Br>
</Br>
</p></td></tr>
</table><p align="center"><img src="../../../logo.gif" align="center"><center><table><tr><td><a href="http://www.ourcode.net" target=_top>www.OurCode.net</a><Br>版权所有: 2002-2008</a></td></tr></table></center></p>
</body><SCRIPT LANGUAGE='JavaScript' SRC='../../../navigate_bar.js'></SCRIPT><SCRIPT LANGUAGE='JavaScript'>write_tail();</SCRIPT></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -