托盘中显示的最佳图标大小 [英] Best Icon size for displaying in the tray

查看:137
本文介绍了托盘中显示的最佳图标大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个Delphi程序,该程序将在托盘上显示一个图标。我这样做是困难的方式(出于某种原因,使用Shell_NotifyIcon api等,而不是组件)。它工作正常,但有时在某些系统中图标似乎有点模糊。现在,我已经尝试使用16x16 bmp,32x32等。系统似乎将其按比例缩小到所需的大小,但结果因操作系统版本(或其他版本)而异。 p>

您是否有任何关于使用ListImage中的Shell_NotifyIcon提取并显示在托盘上的BMP最佳尺寸和颜色深度的经验?

解决方案

您应该使用具有部分透明度的32bpp图标以获得最佳效果。



该图标使用系统尺寸小。通过调用 GetSystemMetrics 传递 SM_CXSMICON 来获取此信息。如果使用字体缩放,则可以为20px,而不是更常见的16px。我从来没有找到有关此事实的MS文档,但您可以通过反复试验轻松地为自己进行验证。



更新: TOndrej指出<$ c $的文档c> LoadIconMetric 默许批准通知区域图标为小图标。我不明白为什么通知图标不包含此信息。


I am working on a Delphi program which will display an icon on the "tray". I am doing it "the hard way" (using the Shell_NotifyIcon api, etc and not a component, for reasons outside the point here). It's working fine but sometimes it seems like the icon is a little "blurry" in some systems. Now, I have experimented using 16x16 bmp, 32x32, etc. It seems like the system scales it down to the needed size, but the results are different depending on the OS version (or perhaps something else as well)....

Have any of you any experience about the best size and color depth of a BMP to be extracted and displayed on the tray using Shell_NotifyIcon from a ListImage?

解决方案

You should be using 32bpp icons with partial transparency for best effect.

The icon uses the small system size. Get this by calling GetSystemMetrics passing SM_CXSMICON. If you use font scaling this can be, for example, 20px rather than the more common 16px. I've never found MS documentation for this fact but you can readily verify it for yourself by trial and error. Not really a happy state of affairs, but it is what it is.

Update: TOndrej points out that the docs for LoadIconMetric gives tacit approval of the notification area icon being small icon size. I don't understand why this information is not included with that for notification icons.

这篇关于托盘中显示的最佳图标大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆