Icons in WinForms - c#

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.

Related

Desktop icon scale to fit when zoomed

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.

Wrong size of "unplated" icon is used

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.

Form icon resized wrong

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

Does WPF embed full size image into output?

I have a WPF application that includes buttons with PNG images. The actual images get scaled by grid control inside the button to about 32 pixels or so (depending on button size). At the same time my original artwork created in Photoshop is 250x250 pixels in size.
Currently I create artwork in Photoshop, add it to my WPF project as a resource, and have WPF automatically scale it to the button size.
Here's my question - if my original image is 250x250 pixels, and WPF squeezes it into a button so that it is only 32x32 pixels, does my output file contain the 250x250 image, or the 32x32 image?
I'm asking because if the app performance is going to be negatively affected by the original image size, I'd rather just scale it in Photoshop myself.
Yes, it will include the full file, because it can't recognize that it might not be shown larger at runtime. You can check this by decompiling your program using ILSpy.

How to load and manage images more efficiently?

I have a front-end program for PND's running Windows CE (both 5.0 and 6.0) It user a high quantity of images (currently in png format) as buttons or for decoration purposes. The images are loaded from the SD Card via the new Bitmap(path);
I'm currently using v3.5 of the framework.
Upon loading, OS + my application have consumed 75 to 80% of the device's memory.
Wich good ways are there to optimize all that files?
The only ways that come to my mind to optimise these picture would be to resize them to the real size they are needed (like most icons will be used in a 16x16 size) and if you store also as bitmap no your card you can also set the used color palette to a size that matches the exact needs of the given picture (e.g. a picture of 16x16 has 256 pixels. So you need a maximum palette of 256 colors, but maybe also a self-defined 16 color palette is enough, cause in your picture are only 16 different colors.)
As a second approach you could also check if you maybe have the same picture multiple times loaded. In this case you should load it only once and use it multiple times.
A last one, that came to my mind belongs to background pictures. If you have a solid background you don't need a fully sized image of it. Just take a 1x1 bitmap and stretch it to the needed size. The same counts for gradient backgrounds, but in this case you have a 1x2 bitmap which will be stretched. And last but not least if you have a regular pattern, just take the smallest unique brick out of it and use some tile mechanism.
If you create the OS, is it possible to store the images as part of the OS?
In case it is possible, and the image is loaded fully to RAM, you can load the images only on a need to display basis and unload them when not needed. This will eliminate some loading time as well since accessing RAM is faster than accessing the SD card.
Another trick in with the same concept would be to copy all the images to a RAM based FS and load them only on a need basis - the down side is that this needs to be done after every reboot.

Categories

Resources