c# - 使用 RenderTransform 时如何防止文本像素化?

标签 c# wpf graphics richtextbox rendertransform

当我使用 RenderTransform 属性并放大 RichTextBox 时,我得到放大的像素化文本(正方形文本边缘)。

我该如何防止这种情况发生? enter image description here

编辑:

我有 TextOptions.TextFormattingMode="Display"- 当我删除这个选项时一切正常!

最佳答案

不能声称我可以用我当前的设置重现它:

enter image description here

这是 20 的比例。我认为这可能取决于 ClearType 系统设置,您可以尝试设置 RenderOptions.ClearTypeHint="Enabled"在 RichTextbox 上,这可能会强制执行它。

也可以尝试设置 TextOptions.TextRenderingMode="ClearType" .

编辑: This SO question非常深入地处理文本呈现,可能会有所帮助。


编辑:看看这个奇怪的地方:

<TextBlock Text="Lorem ipsum dolor sit"
           FontSize="20" TextOptions.TextFormattingMode="Display">
     <TextBlock.RenderTransform>
           <ScaleTransform x:Name="trans" ScaleY="10" ScaleX="10"/>
     </TextBlock.RenderTransform>
     <TextBlock.Triggers>
        <EventTrigger RoutedEvent="Loaded">
            <BeginStoryboard>
                <Storyboard>
                    <DoubleAnimation To="20" Duration="0:0:5"
                                     Storyboard.TargetName="trans" Storyboard.TargetProperty="ScaleX"/>
                </Storyboard>
            </BeginStoryboard>
        </EventTrigger>
     </TextBlock.Triggers>
</TextBlock>

一旦达到一定比例,文本对我来说就变得清晰了,真的很奇怪......

关于c# - 使用 RenderTransform 时如何防止文本像素化?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5850695/

相关文章:

c# - 在 ViewModel 中创建 View 对象

c# - 在哪里存储外部 DLL 文件?

具有参数化构造函数的 Wpf 用户控件

java - OPENGL ES glTranslatef 问题

java - 主动渲染时按键监听器不工作

javascript - 快速缩小图像?

c# - 在 linq 中使用包含

c# - 在隐藏的 ASP.NET 代码中更改控件的可见性 (c#)

c# - 如何在 C#/.Net 中模拟结束进程树

c# - ASP.NET 身份并发登录