CFont初始化中,那些参数的含义是什么,可以给一个创建CFont类的例子么?
我主要是想改变字体的大小。
我主要是想改变字体的大小。
解决方案 »
- 程序执行报错:xxx.dll is not valid windows image 可能是什么原因?
- C++做(ACE框架)C/S服务器网络通讯还有价值吗?
- 怎么样在视频上加标靶(十字瞄准)
- 新版的CSDN论坛找不到_我提问的问题等
- VC如何实现进度条??(如果能用,马上付分)
- 请问有用MD5做文件完整性校验的么?说说思路和那里可以获取参考资料,谢谢!
- 怎么修改一条记录
- 一个简单得不成问题的问题:会VC的朋友请进!帮忙up也一定送分!
- 有关在vb中调用access的问题
- 在属性页里加入的ListCtrl控件,得到焦点后为什么不能刷新?
- 如何从文本文件中逐行读取?
- post模拟登陆的问题 不知道问题出在哪
// select the font object into a DC (device context) for text
// drawing, and finally delete the font object.// Initializes a CFont object with the specified characteristics.
CFont font;
VERIFY(font.CreateFont(
12, // nHeight
0, // nWidth
0, // nEscapement
0, // nOrientation
FW_NORMAL, // nWeight
FALSE, // bItalic
FALSE, // bUnderline
0, // cStrikeOut
ANSI_CHARSET, // nCharSet
OUT_DEFAULT_PRECIS, // nOutPrecision
CLIP_DEFAULT_PRECIS, // nClipPrecision
DEFAULT_QUALITY, // nQuality
DEFAULT_PITCH | FF_SWISS, // nPitchAndFamily
"Arial")); // lpszFacename// Do something with the font just created...
CClientDC dc(this);
CFont* def_font = dc.SelectObject(&font);
dc.TextOut(5, 5, "Hello", 5);
dc.SelectObject(def_font);// Done with the font. Delete the font object.
font.DeleteObject();
一般这样用就可以了LOGFONT lf
CFont font ;
memset(&lf, 0, sizeof(lf)) ;
lf.lfHeight = 字高
lf.lfWeight = 字粗//可不设,默认
strcpy(lf.lfFaceName, "宋体") ;font.CreateFontIndirect(&lf) ;