zoukankan      html  css  js  c++  java
  • Delphi程序开启XP的ClearType显示效果

    微软雅黑字体在没有开启ClearType效果时显示会一塌糊涂,最近项目中因使用了雅黑字体,所以系统启动时候需要自动开启这个功能.

    网上大部份资料都是针对注册表的,几乎没有什么用.

    相关位置:HKEY_CURRENT_USER\Control Panel\Desktop

    类似如下:

    if NOT reg.ValueExists('FontSmoothing') then reg.WriteString('FontSmoothing','2');

    if NOT reg.ValueExists('FontSmoothingType') then reg.WriteInteger('FontSmoothingType',2);

    下面的方法是通过调用SystemParametersInfo来实现:98和2000没有ClearType的功能

    使用方法:

    Font smoothing is handled by the OS, but can be controlled via the SystemParametersInfo API. Please note that the smoothing type does not apply to Win2K, only XP and above.

    // Example usage

    const

    FE_FONTSMOOTHINGSTANDARD   = $00000001;

    FE_FONTSMOOTHINGCLEARTYPE = $00000002;

    SPI_GETFONTSMOOTHINGTYPE   = $0000200A;

    SPI_SETFONTSMOOTHINGTYPE   = $0000200B;

    procedure TForm1.Button1Click(Sender: TObject);

    var dwType:        DWORD;

         bIsSet:        BOOL;

    begin

    if SystemParametersInfo(SPI_GETFONTSMOOTHING, 0, @bIsSet, 0) then

    begin

         if bIsSet then

         begin

            ShowMessage('Font smoothing is applied');

            if SystemParametersInfo(SPI_GETFONTSMOOTHINGTYPE, 0, @dwType, 0) then

            begin

               case dwType of

                  FE_FONTSMOOTHINGSTANDARD   : ShowMessage('Smoothing type is standard');

                  FE_FONTSMOOTHINGCLEARTYPE : ShowMessage('Smoothing type is clear type');

               end;

            end;

         end

         else

            ShowMessage('Font smoothing not is applied');

    end;

    // Enable clear type font smoothing

    SystemParametersInfo(SPI_SETFONTSMOOTHING, 1, nil, SPIF_UPDATEINIFILE or SPIF_SENDCHANGE);

    SystemParametersInfo(SPI_SETFONTSMOOTHINGTYPE, 0, Pointer(FE_FONTSMOOTHINGCLEARTYPE), SPIF_UPDATEINIFILE or SPIF_SENDCHANGE);

    // Disable font smoothing

    SystemParametersInfo(SPI_SETFONTSMOOTHING, 0, nil, SPIF_UPDATEINIFILE or SPIF_SENDCHANGE);

    end;

  • 相关阅读:
    The Joy of Clojure – Laziness(6.3)
    Python Decorator Closure
    Programming clojure – Recursion and Lazyseq
    Programming Clojure Unifying Data with Sequences
    SharePoint Workflow的code运行在哪个进程? w3wp.exe 还是OWSTimer.exe?
    利用PsExec提升命令行的安全级别, 绕过组策略执行命令
    WinDBG脚本入门
    记录一个SPS2010中RSS Web Part报错的问题
    User的Delegation选项卡在Active Directory Users and Computers找不到?
    修改SPS2010的Search Core Results webpart, 令其显示文档被索引了的所有属性
  • 原文地址:https://www.cnblogs.com/MaxWoods/p/3123745.html
Copyright © 2011-2022 走看看