zoukankan      html  css  js  c++  java
  • wpf4 文字 模糊 不清晰 解决方法

    在窗体或控件上设置字体属性就能够了,例如以下:
    <UserControl x:Class="..."
                 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
                 xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
                 mc:Ignorable="d" 
                 d:DesignHeight="400" d:DesignWidth="800"
                 FontFamily="NSimSun"  FontSize="14" 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渲染出来的字体会比較平滑)

    3.TextHintingMode

    获取或设置一个值,该值影响文本元素的呈现行为。这是一种性能优化方式。当您对文本元素的不论什么文本属性进行动画处理时。能够使用此方式。

    此属性的值採用下面两种可能的值:

    Animated 通过使用一个更高效、但视觉精确下降的平滑算法来针对动画进行优化。(文本仍然是可读的;精度损失并不严重。)

    Fixed(默认值)使用的算法针对视觉上精确的字体平滑效果进行了优化,但当将动画应用于字体元素的属性时,可能导致性能问题以及抖动,尤其是对于 FontSize 或转换/定位/投影。

    (在须要对字体做一些动态效果,比如将字体缩放时。使用Animated能获取较高的性能,但同一时候也影响了其显示的清晰度)

    4.WPF4.0中同一时候针对东亚字体的渲染进行了优化,如今它支持点阵字体了。而开启这个新特性十分简单,仅仅需为FontFamily设置一种点阵字体就能够了

    下面是一张推荐设置表

    Language

    Font

    Traditional Chinese

    MingLiu

    Simplified Chinese

    SimSun

    Japanese

    MS Gothic

    Korean

    Gulium

    Korean

    Batang

  • 相关阅读:
    【Yom框架】漫谈个人框架的设计之一:是IRepository还是IRepository<T>?
    【NET】Winform用户控件的初步封装之列表页控件
    【C#】Smtp发送邮件
    c# http请求封装
    js 时区转换
    c# http请求接口
    netcore 中间件记录日志
    netcore 调用log4net
    netcore 从api下载文件并直接返回
    netcore 从api下载文件到本地
  • 原文地址:https://www.cnblogs.com/yjbjingcha/p/6930838.html
Copyright © 2011-2022 走看看