Win32 DrawText行高 [英] Win32 DrawText line height

查看:174
本文介绍了Win32 DrawText行高的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在调用Win32 DrawText函数,以将一些文本输出到设备上下文中.文本很长,可以很好地环绕在第二行上.问题是我需要稍微减少行之间的间距(我想减小行高吗?).有关如何执行此操作的任何想法?

I'm calling the Win32 DrawText function to output some text into a device context. The text is long and wraps nicely onto a second line. The problem is I need to decrease the space between lines a bit (I guess decrease the line height?). Any ideas on how to do this?

我只会调用DrawText两次(每行一次),但随后我必须自己进行自动换行.

I would just call DrawText twice (one for each line) but then I have to do my own word wrap.

还有其他方法吗?

谢谢

推荐答案

一种可能性是将文本放入禁用的Rich Edit控件中.我认为这可以让您更好地控制格式.

One possibility is to put the text into a disabled Rich Edit Control. I think that gives you a lot of control over formatting.

如果您确实编写了自动换行,则可能要使用

If you do write your own word wrap, you probably want to use GetTextExtentExPoint() for measuring how much will fit in each line.

这篇关于Win32 DrawText行高的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆