Windows API——TextOut()函数学习

本文介绍了Windows API中的TextOut()函数,用于在指定位置以选定的字体和颜色写入字符串。函数原型包括TextOutA和TextOutW,接受的参数包括设备上下文句柄、坐标和字符串长度。如果函数成功,返回非零值,失败则返回零。基准点的解释依赖于当前的文本对齐模式,可以通过GetTextAlign和SetTextAlign函数进行查询和修改。VS2010中根据字符集选择使用TextOutA或TextOutW。
摘要由CSDN通过智能技术生成

1.函数功能

The TextOut function writes a character string at the specified location, using the currently selected font, background color, and text color.

TextOut函数使用当前选定的字体、背景颜色和文本颜色在指定位置写入字符串。

2.函数原型

BOOL TextOutA( HDC hdc, int x, int y, LPCSTR lpString, int c );(普通字符)

BOOL TextOutW( HDC hdc, int x, int y, LPCWSTR lpString, int c );(宽字符)

参数:

hdc:当前DC句柄。

x:指定用于字符串对齐的基准点的逻辑x坐标

y:指定用于字符串对齐的基准点的逻辑y坐标

lpString:A pointer to the string to be drawn. The string does not need to be zero-terminated(不必以\0结尾), because cchString specifies the length of the string.

c:指定字符串的长度。

返回值:

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero.

3.备注

The interpretation of the reference point(基准点) depends on the

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值