c# - FlowDocument 内的段落边框显得模糊,SnapsToDevicePixels 和 UseLayoutRounding 均不起作用

标签 c# .net wpf xaml

当我使用 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" 放在 GridFlowDocumentScrollViewer (因为 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/

相关文章:

c# - 我可以使用 .NET Core 编写 PowerShell 二进制 cmdlet 吗?

.net - Windows 服务和多个登录用户

c# - 如何在 .Net WPF 应用程序中使用 Serilog 自动尾部(删除)旧日志?

c# - 将编译日期添加到代码中

.net - 在 MVVM 中,DataTemplates 是否将 Views 视为 UserControls 是 Views?

c# - 将矩阵数组绑定(bind)到 WPF DataGrid

c# - 如何停止动画WPF?

c# - 测试函数 "System.Web.Mvc.ViewEngines.Engines.FindPartialView"

c# - 如何隐藏单选按钮列表中的单选按钮之一?

c# - 获取实体的列名