by KodefuGuru
21. May 2009 10:06
If you're creating toolbars and menus for Visual Studio, the only way to get a crisp icon for the item is to use a 32-bit bitmap, which is a 24-bit bitmap plus an 8-bit alpha channel. Unlike lower bit levels, 32-bit bitmaps support transparency which prevent your icons from looking like a box. Worse still, I discovered that using 24-bit bitmaps creates artifacts in the form of little black dots when rendered.
Unfortunately, unless you have a license to Photoshop, you may discover that none of your tools create 32-bit bitmaps. I don't have a Photoshop license at work so I use Paint.NET to do my graphical work (which is great in most of my scenarios). Here's what the Paint.NET author had to say about why 32-bit bitmaps aren't supported: "GDI+ just refuses to cooperate in allowing me to do that."
Luckily, I found a free tool, AlphaConv, that will convert png files to 32-bit bmp files. My process is as follows.
1) Create a png in Paint.NET with 32-bit Bit Depth.
2) Drag and drop the png into AlphaConv with Target format set to .bmp.
3) Copy the resulting bmp file to my project directory, compile my application.