如何在WPF RichTextBox中设置字距调整字符间距?

时间:2017-12-09 01:13:53

标签: c# wpf xaml

我找不到如何在RichTextBox中设置水平字符间距。

Hello, World! H e l l o , W o r l d !

我只能使用C#设置垂直线高。

Paragraph p = new Paragraph();
p.LineHeight = 50;

rtb1.Document = new FlowDocument(p);

p.Inlines.Add(new Run("Hello, World!"));

XAML的外边距。

<RichTextBox x:Name="rtb1" 
       HorizontalAlignment="Left"
       Height="600"
       Width="300" 
       Margin="188,61,0,0" 
       VerticalAlignment="Top">
     <RichTextBox.Resources>
         <Style TargetType="{x:Type Paragraph}">
             <Setter Property="Margin" Value="50"/>
         </Style>
     </RichTextBox.Resources>
 </RichTextBox>

1 个答案:

答案 0 :(得分:0)

您最常见的选择是:

但是在这里,用户找到了一个很好的(虽然可能是性能密集型)替代两者(阅读接受的答案):

How can I specify letter spacing or kerning, in a WPF TextBox?