|Ned Batchelder : Blog | Code | Text | Site|
Windows notification icons
» Home : Blog : December 2005
About once a year, someone at work decides that we need to tweak the icons on the Windows client. This usually involves getting an outside graphic designer to send us images which are unusable because they don't know what we need for a .ico file. Then a developer munges the images to get the proper transparency, resolutions, and so on, and builds an ico file (@icon sushi is my favorite tool for this).
Then comes the fun of trying yet again to second-guess how Windows is going to choose among the multiple images in the icon. Microsoft technotes notwithstanding, it is not obvious what is going on. In particular, the icon chosen for the notification tray (commonly referred to as the system tray) always looks smudged.
To figure this out, I built a diagnostic icon (rgb.ico). It has three images, 16×16, 32×32, and 48×48. But the three images are designed to look different: they are solid red, solid green, and solid blue respectively. If you look at this file in Windows Explorer, you'll see a red square in the list view, a green square in the icon view, and a blue square in the tiles view:
In the client C# code, I tried setting rgb.ico as the notification icon. Ideally, the red square would display, since it is the 16×16 image. Nope, the green square appears, a perfect 16×16 green square, clearly produced by taking the 32×32 image and scaling it down. No wonder my icons look gross.
I don't know if this is something about the system tray, or about the .NET NotifyIcon class, or what. But it bugs me. To get the pixels I want I'll have to create a special 16-only icon for the notification area?