简体   繁体   English

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

[英]How to prevent text to pixelize when I use RenderTransform?

When I use RenderTransform property and scale up a RichTextBox I get magnified text which is pixelized (square text edges).当我使用 RenderTransform 属性并按比例放大 RichTextBox 时,我得到了像素化的放大文本(方形文本边缘)。

How I can prevent this?我怎样才能防止这种情况?在此处输入图像描述

EDIT:编辑:

I have TextOptions.TextFormattingMode="Display" - when I remove this option everything is fine!我有 TextOptions.TextFormattingMode="Display" - 当我删除此选项时,一切都很好!

Cannot claim that i can reproduce this with my current settings:不能声称我可以用我当前的设置重现这个:

在此处输入图像描述

That is with a scale of 20. I think this could be dependent on the ClearType system settings, you can try setting RenderOptions.ClearTypeHint="Enabled" on the RichTextbox, that might enforce it.那是 20 的规模。我认为这可能取决于 ClearType 系统设置,您可以尝试在 RichTextbox 上设置RenderOptions.ClearTypeHint="Enabled" ,这可能会强制执行。

Also try setting TextOptions.TextRenderingMode="ClearType" .也尝试设置TextOptions.TextRenderingMode="ClearType"

Edit: This SO question deals with text-rendering quite in-depth and might be helpful.编辑: 这个 SO question非常深入地处理文本渲染,可能会有所帮助。


Edit: Check out this weirdness:编辑:看看这个怪异:

<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>

As soon as a certain scale is reached the text becomes clear for me, really odd...一旦达到一定的规模,文本对我来说就变得清晰了,真的很奇怪......

This worked for me:这对我有用:

TextOptions.TextFormattingMode="Ideal" TextOptions.TextFormattingMode="理想"

as suggested on: http://www.newventuresoftware.com/blog/wpf-text-rendering-quirks-scaletransform如建议: http://www.newventuresoftware.com/blog/wpf-text-rendering-quirks-scaletransform

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在保持水平对齐的同时在文本块上使用ScaleX和RenderTransform? - How do I use ScaleX and RenderTransform on a text block whilst keeping horizontal alignment? 如何在ScrollViewer(WP7)中执行RenderTransform? - How can I perform RenderTransform within ScrollViewer (WP7)? SciChart:如何使用RenderTransform移动图表? - SciChart: how to move a chart with RenderTransform? 如何在WPF中用鼠标拖动RenderTransform? - How to drag RenderTransform with mouse in WPF? 如何在wp7中使用RenderTransform(rotation transform)在整个屏幕上移动文本? - How to move the text throughout screen using RenderTransform(rotation transform) in wp7? 如何创建多边形的运行时对象? RenderTransform的值指的是什么? - How can I create runtime object of my Polygon? What does the value of RenderTransform refer to? 如何在执行RenderTransform(缩放和翻译)后获取UIElement的新位置和大小? - How can I get the new position and size of a UIElement after performing a RenderTransform (Scale & Translate)? 当必须动态创建SQL语句时,如何使用参数防止SQL注入? - How can I use parameter to prevent sql injection when I must create SQL statement dynamically? 我可以阻止StreamReader在使用时锁定文本文件吗? - Can I prevent a StreamReader from locking a text file whilst it is in use? 当用户单击文本时,如何防止复选框状态切换? - How can I prevent a Checkbox state switch when the user clicks on the text?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM