这次介绍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 precision DWORD fdwClipPrecision,

本文介绍了在Win32环境下使用GDI进行字体操作的方法,包括获取系统预设字体和自定义创建字体对象。重点讲解了CreateFont函数的参数及含义,并通过示例代码展示了如何设置字体颜色和背景模式。下篇将介绍Win32 GDI的位图处理。
最低0.47元/天 解锁文章
878

被折叠的 条评论
为什么被折叠?



