C#抽绳字母间距 [英] C# Drawstring Letter Spacing
问题描述
使用Graphics.DrawString时是否可以控制字母间距?我找不到允许我这样做的DrawString或Font的任何重载.
Is is somehow possible to control letter spacing when using Graphics.DrawString? I cannot find any overload to DrawString or Font that would allow me to do so.
g.DrawString("MyString",
new Font("Courier", 44, GraphicsUnit.Pixel),
Brushes.Black,
new PointF(262, 638));
按字母间距,我是指字母之间的距离.如果我添加了足够的空间,那么间距为MyString可能看起来像My S r r n g.
By letter spacing I mean the distance between letters. With spacing MyString could look like M y S t r i n g if I added enough space.
推荐答案
开箱即用不支持.您要么必须分别绘制每个字母(很难正确处理),要么自己在字符串中插入空格.您可以使用Graphics.ScaleTransform()拉伸字母,但这看起来很笨拙.
That's not supported out of the box. You'll either have to draw each letter individually (hard to get that right) or insert spaces in the string yourself. You can stretch the letters by using Graphics.ScaleTransform() but that looks fugly.
这篇关于C#抽绳字母间距的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!