0
votes

There is quite a lot of discussions about icons in .NET and they still seem to give different people different problems. Still I dind't find an answer for my case.

I'm writing an application in Visual Studio which runs in Windows 7.

I set application icon in Project/Properties/Application. Nope, still default icon used in taskbar.

So I read that I should set the same icon for the form too.It works now, but still not perfect.

  • If I use icon 48x48 pictures it looks okay in taskbar but is badly resized to 16x16 at form's top.

  • If I use 16x16 it looks okay at form's top but is badly resized with big square pixels in taskbar.

Is there any way to set two different icons for a form? one for form's top and another for taskbar? Or maybe some other approach would work?

2

2 Answers

2
votes

You need to use a .ico file that contains multiple versions of the icon. The system embeds in your executable file these different versions in what is known as an icon group using the RT_GROUP_ICON resource type.

The documentation on MSDN list the sizes that are required to be included in the icon:

Application icons and Control Panel items: The full set includes 16x16, 32x32, 48x48, and 256x256 (code scales between 32 and 256). The .ico file format is required. For Classic Mode, the full set is 16x16, 24x24, 32x32, 48x48 and 64x64.

Note that the 256px icons can (and should) be PNG icons to keep the size manageable.

You'll need to find an icon editor that can make .ico files that contain multiple versions of the image.

You might find this question helpful: Which icon sizes should my Windows application's icon include?

1
votes

An icon file (.ico) can contain many different sizes of icons

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

So you need to specify all sizes you want to display cleanly. Namely: 16x16, 32x32 and 48x48

Get yourself a copy of IcoFx of another good icon editing program that allows multiple sizes (and colour depths) to be saves into one ico file