Delphi XE更改TTrayIcon系统任务栏图标(无模糊)


本文整理自网络,侵删。

 

procedure TForm1.Button4Click(Sender: TObject);
begin
  TrayIcon1.IconIndex := 0;
end;
 
procedure TForm1.Button5Click(Sender: TObject);
begin
  TrayIcon1.IconIndex := 1;
end;


procedure TForm1.Button4Click(Sender: TObject);
begin
  TrayIcon1.Visible := False;
  TrayIcon1.Icon.LoadFromFile('icons\yellow.ico');
  TrayIcon1.Visible := True;
end;
 但是,这似乎在图标上增加了模糊效果(不好)。

为避免此问题,请使用以下方法:
procedure TForm1.Button5Click(Sender: TObject);
begin
  TrayIcon1.Visible := False;
  TrayIcon1.Icon.LoadFromFile('icons\red.ico');
  TrayIcon1.Visible := True;
end;

这样,图标在系统任务栏中看起来大部分都是像素完美的。

在Windows 7和Windows 10上也进行了测试。

如果要从ICONS资源中加载图标:
procedure TForm1.Button4Click(Sender: TObject);
begin
  TrayIcon1.Visible := False;
  TrayIcon1.Icon.LoadFromResourceName(hInstance, 'ICON1');
  TrayIcon1.Visible := True;
end;

相关阅读 >>

Delphi通过url获取网页源码

Delphi 快捷键

Delphi 完美获取硬盘id

Delphi android 启动卡死处理方法

Delphi 为richedit设置行号

Delphi编程之win10桌面图标设置

Delphi 移动桌面图标

Delphi padl 处理字符串的函数

Delphi+汇编例子

Delphi 每年、月、周、日的开始与结束的时间startofayear … startoftheyear … endofayear … endoftheyear

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...