سؤال

See http://inky.ws/g/21s for screencaps of the text rendering distortion.

I apply this style to get a glow effect:

<Style TargetType="FrameworkElement" x:Key="GlowBright"
       BasedOn="{StaticResource ToolTipBase}">
    <Setter Property="Effect">
        <Setter.Value>
            <DropShadowEffect Opacity="1" ShadowDepth="0" BlurRadius="7"
                              Color="White"/>
        </Setter.Value>
    </Setter>
</Style>

<!-- Expander headers, Group box headers, Check box headers, Labels -->
<Style TargetType="TextBlock" BasedOn="{StaticResource GlowBright}"/>

Unfortunately, it's making certain element rendering glitchy. The glitches change or disappear when I resize the window. So... how to avoid the glitches?


Edit - doing this:

<Style TargetType="TextBlock" BasedOn="{StaticResource GlowBright}">
    <Setter Property="TextOptions.TextFormattingMode" Value="Ideal"/>
    <Setter Property="TextOptions.TextHintingMode" Value="Fixed"/>
    <Setter Property="TextOptions.TextRenderingMode" Value="ClearType"/>
</Style>

does not help.

هل كانت مفيدة؟

المحلول

It's possible you're running into issues with your video card drivers, as the DropShadowEffect is accomplished with a pixel shader (compiles into a special routine that runs on the video card.) It's not at all uncommon for older drivers to introduce visual defects when using shaders. If this is only occurring on your machine, this is likely the cause.

نصائح أخرى

Try adding this attach property TextOptions.TextFormattingMode. More can be found through MSDN

<TextBox TextOptions.TextFormattingMode="Ideal" FontSize="15">HELLO WORLD</TextBox>

*

Guidelines for this property

Scenarios Recommended Mode

Large Text (15pt+) = Ideal \ Display (users preference)

Transformed Text = Ideal

Zoomed Text = Ideal

Design Scenarios = Ideal

Small Text = Display

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top