0
votes

ALL,

I am making an application where I need to use an icon. I have 2 icon files: myicon-16.ico and myicon-32.ico. First has resolution 16x16 and second - 32x32. Now when I opened MSVC 2010 project (C++) I see that the default icon file has 2 icons combined, i.e. it has a resource for 16x16 and 32x32 in one file. What I mean is when I open the resource file in Visual Studio solution and click on the standard icon I see many different resolution for the icon. And I can select each and the bitmap (icon) will be displayed with an appropriate resolution. But when I open the rc file in the text editor I see only 2 lines: one with my own icon and one with the standard icon "IDI_SMALL".

What I need to do to make the same thing with my 2 files? What I want is when I open resource file in VS and click on my icon resource I want to see 2 icons with 16x16 and 32x32 resolutions. AFAIU, I can only place an additional icon resource in the rc file. Or I am wrong?

Please advise.

2
I think you need to combine your icons into a single file (using an editor like IcoFX) but am not so sureuser948581

2 Answers

1
votes

You can use VS2010 to add additional image types in your ico file. Just open an ico file with VS2010. Say, open myicon-16.ico. You will see just one icon there - 16x16. Now open menu Image->New Image Type (or use right click->New Image Type, or use keyboard shortcut Ins). You will be presented with a choice ranging from 16x16 1 bit to 128x128 24 bit. Just insert as many as you like.

For your case you need to insert an empty 32x32 into myicon-16.ico, then copy and paste from your 32-pixel file.

On the side note. Who draws the icons nowadays. Just google free icons, and you will find tons of icon libraries on the Internet with sizes from 16x16 to 256x256 png.

0
votes

Yes, you need to combine your images into one ICO file that has all the data.

From Wikipedia:

ICO files contain one or more small images at multiple sizes and color depths, such that they may be scaled appropriately.

There are many image editors that can do this, personally I've used GIMP to create multi-layered png files, and then save as .ico to get the final result.

You also should be able to right click in the list of image sizes in VS2010 and then click "New Image Type" to add different resolutions within the built in ICO editor. You can then copy and paste your image data from another editor into Visual Studio.