views:

188

answers:

2

Dear community.

I would like to know if the following is possible.

I have an .ico file, containing several sizes and color depths. However, it also contains some custom made sizes, that are going to be used inside my application.

The application accesses the icon trough a resource DLL. (The intention is that the DLL is provided by a third party developer)

Is there any way to pinpoint exactly which of the icons in the .ico file to use in my application? Like I want this size to appear here on my GUI etc.

For instance, I am making a button in my application, and I would like my custom made 15*32 icon from my .ico file to be displayed on the button.

I know this is possible by adding the bitmaps one at a time to the resource DLL, giving each of them a unique name.

But it would be easier, if I am able to identify the different contents of the icon file instead.

Is it possible in some way to look at the icon file as an array of icons or something like that?

Any help is much appreciated. It seems quite hard to find information about this subject on the web.

Oh, and I am writing my application in C#, using MFC DLL (from Visual C++ to create my resource DLL)

A: 

Codeproject: IconLib might help you.

winSharp93
Thanks a million, buddy. Don't know why that page slipped my search :)
Sagi1981
+1  A: 

This is how I get the exact-sized image from an .ico file.

Icon myIcon = new Icon(@"C:\myIcon.ico");
Icon buttonIcon = new Icon(myIcon, 15, 32);
Damien