唯一的方法我可以看到的一种可能性是使用FlowDocumentScrollViewer作为TextBlock的内容.它允许您使用具有Paragraph对象的FlowDocument,该对象具有FontSize和LineHeight属性.这将使您能够在一定程度上更改LineBreak的高度,这可能不会像您想要的那么小.
<Grid>
<TextBlock LineHeight="1" Height="85" Width="400" HorizontalAlignment="Left" Margin="12,29,0,0" Name="textBlock1" VerticalAlignment="Top" Background="Beige" >
<FlowDocumentScrollViewer Width="400" VerticalScrollBarVisibility="Hidden" >
<FlowDocument>
<Paragraph LineHeight="1" FontSize="12" FontFamily="Arial" Foreground="Red" >
<Run> This is a Test of line height</Run>
</Paragraph>
<Paragraph LineHeight="1" FontSize="1" BorderThickness=" 1" BorderBrush="Black">
<LineBreak/>
</Paragraph >
<Paragraph LineHeight="1" FontSize="12" FontFamily="Arial" Foreground="Blue">
<Run> This is a Test of line height</Run>
</Paragraph>
<Paragraph LineHeight="1" FontSize="2" BorderThickness=" 1" BorderBrush="Black">
<LineBreak />
</Paragraph>
<Paragraph LineHeight="1" FontSize="12" FontFamily="Arial" Foreground="Green" >
<Run> This is a Test of line height</Run>
</Paragraph>
<Paragraph LineHeight="1" FontSize="5" BorderThickness=" 1" BorderBrush="Black">
<LineBreak />
</Paragraph>
</FlowDocument>
</FlowDocumentScrollViewer>
</TextBlock>
</Grid>
Run Code Online (Sandbox Code Playgroud)
这给了我这样的结果.
添加一些其他信息.我相信你在线之间看到的大部分差距都与文本行的LineHeight有关.我玩了一点点,然后想出了这个.它还具有不需要流文档的额外好处.
<TextBlock LineHeight="9.75" LineStackingStrategy="BlockLineHeight" Margin="12,188,-12,-188">
<Run> This is a Test of Line Height</Run>
<LineBreak />
<Run >This is a Test of Line Height</Run>
<LineBreak />
<Run>This is a Test of Line Height</Run>
<LineBreak />
<Run> This is a Test of Line Height</Run>
</TextBlock>
Run Code Online (Sandbox Code Playgroud)
这给了我一个看起来像这样的结果.它会让你比你原来要小