Fog Creek Software
Discussion Board




Welcome! and rules

Joel on Software

Icons in WinForms app

What is the best way to distribute external icons (not compiled in the .exe file) in a .NET WinForms app?

I'm in the process of creating icons with 9 formats according to this MSDN article:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwxp/html/winxpicons.asp?frame=true

These formats are stored in a single .ico file.  However, when I put the .ico file into a .resource file (of type System.Drawing.Icon), only one format is imported:  the one corresponding to my current display settings.

I thought the "standard" way of doing this was to specify a multi-format icon and let Windows determine which format to use based on the display settings.  If I break the icon up into multiple resources, then my app will have manually evaluate the display settings and load the appropriate icon.

Am I missing something with the .resource file?  Is there another way to do this?

Joe Paradise
Friday, September 05, 2003

Meant to say ".resources" file (a compiled .resx file).

Joe Paradise
Friday, September 05, 2003

After experimenting with a test project I found that all icon formats are stored as expected, but the System.Drawing.Icon class will only expose the format that corresponds to the current display settings.

Joe Paradise
Monday, September 08, 2003

*  Recent Topics

*  Fog Creek Home