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.
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.
GetSystemMetrics(SM_CXSMICON)
to find out the size needed. As for colour depth, it doesn't matter. The system will display the icon you provide. If you provide one with the wrong size then it will resize. That looks terrible. What size is the one you are providing? –
Pigeon I believe it's best to create your icon in multiple sizes and let Windows choose the best one. You're never sure how large the system tray is, because different users may have different settings.
That could also be the reason yours seems distorted. Say you're using a 16x16, but you've set Windows to display them 18x18. If you haven't provided an 18x18 icon, it'll be distorted.
See this question and Larry Osterman's answer.
NOTIFYICONDATA
structure you supply an HICON
which only contains a single image. Could you elaborate on how you would go about supplying multiple images in the NOTIFYICONDATA
struct. –
Pigeon NOTIFYICONDATA
contains an HICON
and not a .ico file. So you have to decide. –
Pigeon © 2022 - 2024 — McMap. All rights reserved.