Icon Display in WinForms Application

When the application icon is displayed, is Windows who decides which version (bit depth) to use or is it somehow specified in the ICO file?

If I create an ICO file with only 32-bit colors (24-bit + 8-bit transparency), the icon will appear in Win XP. If I add, for example, a 4-bit version, Windows will always use this 4-bit version, even if there are 32-bit images. My monitor is set to 32-bit colors. I use the Greenfish icon editor if that matters.

Is there a way to force Windows to use 32-bit icons instead of 4-bit ones?

EDIT: I used IcoFX to simply open the source ICO file and save it again, and now Windows always selects the correct bit depth. Interesting...

+5
source share
2 answers

It is selected by Windows based on the bit depth of the surface on which it is drawn. It also depends on the actual order of the icons inside the .ICO file (or resource), so you get a different result with IcoFX.

+2
source

Windows will use the icon with any depth that it can display, so your understanding of how everything should work is correct.

I have not used Greenfish, so I do not know if it creates the icon file correctly. If you are using VS2008, you can try (for free) Axialis IconWorkshop to double-check the icon file (they have a non-free standalone version too).

+1
source

All Articles