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
passingSM_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.You should probably include both 32x32 and 16x16 icons and load the appropriate one at runtime:
(source: MSDN)
A single
*.ico
file is recommended for app icons.*.ico
file can store different sizes of icons like 16, 32, 256 etc. You can convert different image files to ico format online here.For tray icon 16x16 or 32x32 ico would fit.
Official msdn guide for icons: icons in Windows