这次介绍win GDI的文字部分,开发环境vs2013,语言C/C++,使用的是win32项目。
win32GDI字体
win32GDI字体的输出跟画笔很类似
首先我们要定义字体句柄,然后可以通过两种模式来获得字体对象
1.获得系统预设字体对象 : HFONT hfont = (HFONT)GetStockObject(ANSI_FIXED_FONT);
2.自己创建字体对象 HFONT hfont = CreateFont();
我们主要介绍第二种
CreatFont()函数参数如下
HFONT CreateFont( int nHeight, // height of font int nWidth, // average character width int nEscapement, // angle of escapement int nOrientation, // base-line orientation angle int fnWeight, // font weight DWORD fdwItalic, // italic attribute option DWORD fdwUnderline, // underline attribute option DWORD fdwStrikeOut, // strikeout attribute option DWORD fdwCharSet, // character set identifier DWORD fdwOutputPrecision, // output precisio