[WPF]wpf4 文字模糊不清晰解决方法

wpf4 文字模糊不清晰解决方法
在窗口或控件上设置字体属性就可以了,如下:

FontFamily="NSimSun"  FontSize="14" TextOptions.TextFormattingMode="Display"

关键代码:
TextOptions.TextFormattingMode="Display"

参考

WPF4对字体渲染做了很大的改善,增加了TextOptions属性,该属性可以设置TextFormattingMode,TextRenderingMode,TextHintingMode

1.TextFormattingMode

它提供了两种设置:

· Ideal —— WPF4之前的模式
· Display —— 新的模式,可以使字体显示更清晰
(一般将TextFormattingMode设置为Display,可以提高字体显示的清晰度)

2.TextRenderingMode

设置渲染模式,可以有以下设置:

Auto – This mode will use ClearType unless system settings have been set to specifically disable ClearType on the machine.
Aliased – No antialiasing will be used to draw text.
Grayscale – Grayscale antialiasing will be used to draw text.
ClearType – ClearType antialising will be used to draw text.

(一般用ClearType渲染出来的字体会比较平滑)

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。