当我使用 BorderThickness
属性在 FlowDocumentScrollViewer
中的 FlowDocument
内的 Paragraph
元素上绘制边框时,边框有时模糊。
这是我的代码片段。
<Grid>
<FlowDocumentScrollViewer>
<FlowDocument>
<Paragraph BorderBrush="Black" BorderThickness="0.5">This is a paragraph</Paragraph>
<Paragraph BorderBrush="Black" BorderThickness="0.5">This is a paragraph</Paragraph>
<Paragraph BorderBrush="Black" BorderThickness="0.5">This is a paragraph</Paragraph>
</FlowDocument>
</FlowDocumentScrollViewer>
</Grid>
我尝试将 SnapsToDevicePixels="True"
和 UseLayoutRounding="True"
放在 Grid
或 FlowDocumentScrollViewer
(因为 Paragraph
本身不支持这些属性),但什么也没有发生。
这个问题还存在吗?如果没有,我该如何解决?
最佳答案
<Grid RenderOptions.EdgeMode="Aliased">
<FlowDocumentScrollViewer>
<FlowDocument>
<Paragraph Margin="2" BorderBrush="Black" BorderThickness=".5">This is a paragraph</Paragraph>
<Paragraph Margin="2" BorderBrush="Black" BorderThickness=".5">This is a paragraph</Paragraph>
<Paragraph Margin="2" BorderBrush="Black" BorderThickness=".5">This is a paragraph</Paragraph>
</FlowDocument>
</FlowDocumentScrollViewer>
</Grid>
关于c# - FlowDocument 内的段落边框显得模糊,SnapsToDevicePixels 和 UseLayoutRounding 均不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15729299/