문제

I'm getting quite weird behavior with ClearType whenever I use AeroGlass in my WPF applications. I have found out that the following line sets my font rendering back to grey-scale:

mainWindowSrc.CompositionTarget.BackgroundColor = Colors.Transparent;

To get it back to work with AeroGlass I must set these .NET 4.0 properties to every control containing text:

RenderOptions.ClearTypeHint="Enabled" TextOptions.TextFormattingMode="Display" TextOptions.TextRenderingMode="ClearType"

Then it looks like this:

grey-scale on the left, cleartype on the right

Is there a way to achive the same effect without setting these properties to every control on the window?

Thanks.

도움이 되었습니까?

해결책

You could set this globally in the MainWindows constuctor.

Something like this:

RenderOptions.ClearTypeHintProperty.OverrideMetadata(typeof(FrameworkElement), new FrameworkPropertyMetadata { DefaultValue = ClearTypeHint.Enabled });
TextOptions.TextFormattingModeProperty.OverrideMetadata(typeof(FrameworkElement), new FrameworkPropertyMetadata { DefaultValue = TextFormattingMode.Display });
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top