某些字体在字符上方和下方有大量空白。有没有办法纠正这个问题,并收紧 WPF 中自动换行段落的行之间的空间(在 TextBlock 或 FlowDocument 中)?有点像行之间的负边距?
and上有一个LineHeight
属性,但它似乎只能让你增加间距——如果你将它设置为比默认值更小的值,它就会被忽略。Paragraph
TextBlock
之前设置LineHeight
like,但更改LineStackingStrategy
为BlockLineHeight
举例说明@Joel的答案(5年后仍然非常有用:P)
<StackPanel VerticalAlignment="Center">
<Button Width="137" Height="47.96">
<TextBlock Text="This is a very long text that gets cut because it is so long" TextWrapping="Wrap"/>
</Button>
<Button Width="137" Height="47.96">
<TextBlock Text="This is a very long text that doesn't cut thanks to @Joel" TextWrapping="Wrap"
LineStackingStrategy="BlockLineHeight" LineHeight="13"/>
</Button>
</StackPanel>