作者:cshaadi_915 | 来源:互联网 | 2023-10-10 15:51
IdliketomodifythespacingbetweencharactersinaWPFTextBox.Somethingliketheletter-spacin
I'd like to modify the spacing between characters in a WPF TextBox.
Something like the letter-spacing: 5px
thing that is available in CSS.
I think it is possible in XAML; what's the simplest way?
我想修改WPF TextBox中字符之间的间距。像字母间距:CSS中可用的5px之类的东西。我认为在XAML中是可能的;什么是最简单的方法?
I found the "Introduction to the GlyphRun Object and Glyphs Element" document, and found it to be exceedingly unhelpful.
我找到了“GlyphRun对象和字形元素简介”文档,发现它非常无益。
This is a code example from that page:
这是该页面的代码示例:
The same documentation page gives this "explanation" for what the Indices
property does:
相同的文档页面为Indices属性提供了“解释”:
I have no idea what any of that means. I'm also not sure that Indices is the right thing - the comment in the code speaks of "character widths" which I don't care about. I want to adjust the width between characters.
我不知道这是什么意思。我也不确定指数是否是正确的 - 代码中的注释说的是“字符宽度”,我并不关心。我想调整字符之间的宽度。
Also, there is no example for how to apply a Glyphs
element to a TextBox. When I tried it, my WPF test app just crashed.
此外,没有关于如何将Glyphs元素应用于TextBox的示例。当我尝试它时,我的WPF测试应用程序崩溃了。
What I want to do is slightly increase the empty space that appears between drawn characters within a WPF TextBox. The text will vary in length and content. Do I have to modify the Indicies
property every time there is a new character? Is there a way to say "make it 20% more space than usual, for every character".
我想要做的是略微增加WPF TextBox中绘制的字符之间出现的空白区域。案文的长度和内容各不相同。每次有新角色时我是否必须修改Indicies属性?有没有办法说“为每个角色增加20%的空间”。
Can anybody help me?
有谁能够帮助我?
3 个解决方案