i couldn't find any information regarding system tray icons, what size should they be in to get the best possible quality. Should i use more than one size (16x16,32x32,64x64)?
I'm currently using 16x16 .ICO icons and they look disorted.
They are small icons (ICON_SMALL
). You can find out the size by calling:
GetSystemMetrics(SM_CXSMICON)
I think it's pretty safe to assume that they are square, but if you are paranoid then you can always inquire about SM_CYSMICON
.
On my Windows 7 machine they are 16px in size. But if you are using font scaling then they will be larger. For a 125% font scaling (e.g. large fonts) you will need a 20px icon.
If you don't have a 20px version at hand then the best approach is to generate one on the fly and put your 16px version in the middle of the new 20px icon.
Update
The documentation of NOTIFYICONDATA
recommends using LoadIconMetric
passing LIM_SMALL
which is equivalent to the approach I outline above.
However, the NOTIFYICONDATA
topic also says to use an icon resource containing just16px and 32px versions of the icon. That advice is bogus because, as anyone can see for themselves, notification icons under large fonts are 20px icons and LoadIconMetric
will have scale from 32 to 20. I would recommend supplying 16, 20, 24, 32px versions.
On XP LoadIconMetric
doesn't exist so you'd need to implement a fallback routine.