Delphi程序开启XP的ClearType显示效果
2013-06-07 14:10
441 查看
微软雅黑字体在没有开启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;
网上大部份资料都是针对注册表的,几乎没有什么用.
相关位置: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;
相关文章推荐
- 通过程序开启XP的ClearType显示效果
- 第四题(迅雷笔试题):编写一个程序,开启3个线程,这3个线程的ID分别为A、B、C,每个线程将自己的ID在屏幕上打印10遍,要求输出结果必须按ABC的顺序显示;如:ABCABC….依次递推。
- xp任意程序无需登录自动开启
- 单纯的使用一张图片,设置为 SplashScreen 的方式我已经使用过了,是有效果的,但是现在我想更进一步的显示出当前程序的状态,如正在初始化设备,这类的状态
- 怎样开启Win7快速启动栏以及怎样显示右下角运行程序通知
- Visual C++ 6.0 中 MFC 单文、多文档程序工具栏在 XP 风格下显示不正常的解决办法
- 编写一个程序,开启3个线程,这3个线程的ID分别为A、B、C,每个线程将自己的ID在屏幕上打印10遍,要求输出结果必须按ABC的顺序显示;如:ABCABC….依次递推。
- 编写一个程序,开启3个线程,这3个线程的ID分别为A、B、C,每个线程将自己的ID在屏幕上打印10遍,要求输出结果必须按ABC的顺序显示;如:ABCABC
- 2 编写一个应用程序,用户分别从两个文本框输入学生的姓名和分数,程序按成绩排序将这些学生的姓名和分数显示在一个文本区中。 程序运行效果如图:
- 笔试题:编写一个程序,开启3个线程,这3个线程的ID分别为A、B、C,每个线程将自己的ID在屏幕上打印10遍,要求输出结果必须按ABC的顺序显示;如:ABCABC….依次递推。
- Qt主窗体显示最前 在delphi中使用Application.BringToFront;可以保证当前程序显示在最前。 然而今天在Qt中,没有类似函数供调用。 尝试了activeWindow,s
- Delphi 设置窗体的属性(最前端显示、淡入淡出效果、滑动效果)
- 编写一个程序,开启3个线程,这3个线程的ID分别为A、B、C,每个线程将自己的ID在屏幕上打印10遍,要求输出结果必须按ABC的顺序显示;如:ABCABC….依次递推
- XP远程桌面模式下开启ClearType
- 编写一个程序,开启3个线程,这3个线程的ID分别为A、B、C,每个线程将自己的ID在屏幕上打印10遍,要求输出结果必须按ABC的顺序显示;如:ABCABC….依次递推
- 编写一个程序,开启 3 个线程,这三个线程的 ID 分别为 A、B、C,每个线程将自己的 ID 在屏幕上打印 10 遍,要求输出的结果必须按顺序显示。如:ABCABCABC…… 依次递归
- XP下运行使用delphi XE2 皮肤编译的程序的小问题
- Android程序后台开启服务,显示通知栏
- 用于修复XP中最小化程序 在任务栏显示图标的vbs脚本
- 使用U盘PE安装系统,显示安装程序无法重新启动计算机,请关闭所有应用程序并且关机,以便继续进行XP安装。找不到网络路径。的解决方法