创建字体

来源:互联网 发布:淘宝如何设置套餐价格 编辑:程序博客网 时间:2024/05/18 00:15
m_fFont.CreateFont(18, // nHeight 
0, // nWidth 
0, // nEscapement 
0, // nOrientation 
FW_LIGHT, // nWeight 
FALSE, // bItalic 
FALSE, // bUnderline 
0, // cStrikeOut 
ANSI_CHARSET, // nCharSet 
0, // nOutPrecision 
0, // nClipPrecision 
0, // nQuality 
0, // nPitchAndFamily 

_T("雅黑")); 


应用

dc.SelectObject(&m_fFont);


根据当前dc,计算字符串占用分辨率

GetTextExtentPoint32(dc.GetSafeHdc(),strText,strText.GetLength(),&szSize);

原创粉丝点击