我们如何使用LogFont Struct和drawtext绘制具有相同宽度的每个char的字符串 [英] How can we draw a string with each char of same width using LogFont Struct and drawtext
本文介绍了我们如何使用LogFont Struct和drawtext绘制具有相同宽度的每个char的字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用drawtext函数我们如何绘制每个宽度相同的字符串。
例如:
Sushant | Mandhare
Prashant | ABCXYZP
如果上述两个字符串长度相同,因为每个字符的宽度不同,我不会得到下面的分隔符另一个
解决方案
如果你使用比例字体(这是默认的,真的,大部分都是),那么你会看到这种效果。如果您希望字符在多行上排成一行而不必大惊小怪,则需要使用非比例字体,其中每个字符的宽度相同。微软机器上的几个例子是Courier和Lucida Console。
还有其他解决方案(例如设置和使用标签)。
Using drawtext function how can we draw a string with each character of same width.
For Eg:
Sushant |Mandhare
Prashant |ABCXYZP
if both the above strings are of same length,since width of each character is different im not getting the separator one below the other
解决方案
If you use a proportional font (which is the default and really, most of them) then you will see this effect. If you want the characters to line up on multiple lines without a lot of fuss, you need to use a non-proportional font, where each character is the same width. A couple of examples on Microsoft machines are "Courier" and "Lucida Console".
There are other solutions as well (eg. set and use tabs).
这篇关于我们如何使用LogFont Struct和drawtext绘制具有相同宽度的每个char的字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文