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?
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?
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
Related
I have a problem where my icon doesn't scale to fit when I zoom in on it when it's on my desktop.
Followed by when I zoom in.
How can I make sure the image for my program scales as well?
It does scale down, but it stops scaling up after it gets to its default size.
I'm using Visual Studio and my software is done in C# WPF.
This has nothing to do with code. Your *.ico File is missing the supported images.
The *.ico icons can have different images for multiple sizes, eg. 16x16, 32x32, 48x48, 128x128, 256x256.
There is this question on SuperUser how to embed them.
I'm currently building a wpf application and am looking for a "generic" looking set of icons like they are used in windows explorer, they can be something between xp and 10 style as long as I have a consistent set of icons in .png format for functions like: new file, open, save, save as, send to, undo, redo, ...
Is there a way to use the windows internal once?
Or a way to get some from the internet?
I tried the VS2015 Image Library but the icons there have different resolutions and colors. I couldn't even find a pair for undo/redo with the same resolution/color.
Here's the list of dlls that you can get icons from on any windows OS:
%systemroot%\system32\imageres.dll - contains lots of icons, used almost everywhere in Windows 10. It has icons for different types of folders, hardware devices, actions, and so on.
%systemroot%\system32\shell32.dll - also has lots of icons used in various parts of Windows 10. Together with imageres.dll , shell32.dll hosts one of the largest icon collections in Windows 10.
To get the complete list of dlls check out this article.
I am writing a UWP app that includes an "unplated" icon at the 32x32 size (file name Square44x44Logo.targetsize-32_altform-unplated.png). I also have the same icon at the 24x24 size (file name Square44x44Logo.targetsize-24_altform-unplated.png). I also have the same two sizes in non-"unplated" variants. However, when I build and run my app, the icon used in the taskbar (and only the taskbar) is of an incorrect size. The 24x24 icon is used, instead of the 32x32 icon, resulting in the icon appearing visibly smaller than the others in the taskbar. See picture below.
I have followed the advice in this question, to no effect.
The 24x24 icon is used, instead of the 32x32 icon, resulting in the icon appearing visibly smaller than the others in the taskbar.
Your icon looks smaller than others might because it's rectangle. It has fewer number of pixels on the vertical, showing it in a "unplated" fashion would make it "looks" smaller.
Below is a screenshot of the zoomed image, it shows that your icon has the same width with another two icons.
In this case, I suggest you using the “plated” icon to see if your icon is the same size of others.
Windows 10 introduces an evolution of the existing scaling model. In addition to scaling vector content, there is a unified set of scale factors that provides a consistent size for UI elements across a variety of screen sizes and display resolutions.
For more information, see to Guidelines for tile and icon assets.
As we know when we use notifyicon control in c# and place it in systemtray and it is displayed, windows overrides its size and make it 16*16 so can we somehow change its size? make it little bigger like system "date and time" display or like "input method type" in windows 8. I want to display certain text there.
Thanks in adv.
The system draws the icon, and it decides what size it is. For what it is worth, notification icons are the system's small icon size. So in fact you should not assume that they will be 16px icons. For font scalings larger than 100% the small icon size will be larger than 16px.
At the Win32 level, the application supplies an HICON, and the system draws that. If it needs to resize it, it will. You cannot custom draw in the notification area.
Imagine if applications could custom draw in the notification area? All it would take would be for a couple of applications to decide that they were so awesomely important that they had to custom draw large amounts of information. And then there'd be no room left for the rest of the taskbar.
So, the bottom line here is that you will need to find some other UI approach to solve your problem.
I created an icon with two different image sizes in it:
one 16x16 with 24bpp
one 32x32 with 24bpp
using the icon editor in Visual Studio.
I had hoped that when used by a form (the Form's Icon-propery) I would see the 16x16 version in its upper left corner and the 32x32 version on the task bar. Unfortunately, the 16x16 version is used in the task bar as well.
So my question is simply: how can I persuade Windows to make a "better" choice between the differnt sizes in my icon file?
Import the different sized images into Gimp as layers. Make sure the larger icon is the top layer. Then you can export as .ICO and Gimp will make one file containing multiple icons.
Change the order of the image in .ico file: Biggest -> Smallest.
To have the best quality of an icon for any use, I will create the largest size. This size is 256*256. It will help you to have a better quality, except smaller size that the windows won't manage them as unique, So try to create 256' , 32' and 16' separately as images and combine them as .ico file.