Windows 7 icon sizing problems - c#

I'm trying to create an application icon. I took a bunch of created *.ico files (one for each size) and combined them into a single *.ico file. I can see them all fine. I have 16x16, 32x32, 48x48, 64x64, and 128x128 icons (all 32bit w/ transparency).
However, when I build my app (a standard Windows Forms app written in C#) and look at the icon in Windows explorer, it looks fine at the first few sizes (up to 48x48 I think.. "Medium"), but if I use the "Large" or "Extra Large" display modes in Windows Explorer, I just see the 48x48 (I think) icon in an ever larger box.
How can I get Windows Explorer to recognize the larger icons? What am I doing wrong? Has anyone seen this issue before, and point me in the correct direction? I'm assuming there's a problem with the way the *.ico file is built, or the formats... but I can't find any hints anywhere.

As far as I understand it, once you get above a certain size (and it may well be 48x48), Explorer will go looking for a 256x256 icon, and scale it to the desired size.
128x128 is not a standard icon size, and Explorer may not bother looking for it. You can show icons at up to 256x256 in Explorer ("Extra Large icons"), though you can do sizes in between. If you size your icons to, say, 192x192, then it's going to look better to take a large image and scale it down, rather than to take a small image and scale it up -- so you're better off adding a 256x256 image anyway, rather than a 128x128.

Related

Quickly loading, resizing, and displaying images from disk

I'm learning my way around windows forms by making a little app to help clean up a folder on my PC with thousands of images. I'm currently storing the images as a List<FileInfo>. It works fine using
PicBox.Load(ImageFileList[count++].imgFile.FullName);
but that's a bit slow when I only need a second to look at each image.
So the problems are:
How to load the images quickly
How to do so in a folder where one image might be a 25kb png and the next might be a 1GB TIFF
If I open an image from the folder in Windows Photo Viewer and hold the right arrow key, it zips along with blurry images I assume are resized thumbnails and a loading message over them. In Win 10 Photos, it loads non-blurry images faster but hiccups when it hits larger files. Either of those behaviors would be fine for me.
Try to do your things using background tasks :
https://learn.microsoft.com/en-us/dotnet/desktop/winforms/controls/walkthrough-implementing-a-form-that-uses-a-background-operation?view=netframeworkdesktop-4.8
Maybe this can help too :
https://learn.microsoft.com/en-us/dotnet/api/system.windows.forms.application.doevents?view=windowsdesktop-6.0

Control Application Flow According to Screen Size

I am new to windows phone development. I have an issue regarding screen size variation and I successfully handle the UI according to resolution but problem is that I don't have any idea how to change the size of text for different resolutions, use different images for different resolution etc.
As in Android we have different asset folders. We just put our data in folders and it will use best option automatically according to the screen size . I did a lot of Googling but did not find a suitable solution for it. Any idea how I can achieve this?
You shouldn't pay attention to screen sizes at all, everything is scaled up automatically and applications look good on smaller and larger screens.
If you want to customize the design for your screen depending on the screen size, DPI or something else, take a look at the proposed solution here: http://developer.nokia.com/community/wiki/Advanced_Techniques_for_Big_UI.

NotifyIcon and High DPI Displays

Following this guide: http://www.hhhh.org/cloister/csharp/icons/ I was able to get my NotifyIcon to look the way it should because Windows decides to use the 32x32 icon and scale it to a 16x16 instead of just using the 16x16 icon.
That being said, I have an .ico file with the following resolutions:
256x256x32
64x64x32
48x48x32
32x32x32
16x16x32
48x48x8
32x32x8
16x16x8
32x32x4
16x16x4
However, when I increase the DPI settings on my display, the icon displayed in the NotifyIcon is a higher resolution version, with more embellishments that end up looking terrible scaled to the size of the NotifyIcon. What size icon is it taking and scaling now? Would I be better off just creating a simple icon of every size specifically for the NotifyIcon?
The icons displayed in the notification area are small icons. That is their size is given by the SM_CXSMICON system metric. Find out that size and supply an icon of the exact dimensions to avoid aliasing. If you have not got one the exact size to hand, probably the best you can do is to draw the closest smaller sized icon onto the middle of an empty transparent canvas, and use that.
You may not be able to do this using the managed NotifyIcon wrapper. I expect that you don't get enough control. The procedure I describe really requires you to be able to call Shell_NotifyIcon, the native API, and pass an HICON.
This page http://msdn.microsoft.com/en-us/library/bb773352(VS.85).aspx gives an example of how to pass the correct icon for the correct DPI. It uses LoadIconMetric, which probably isn't directly available in c#, but it would be simple to marshal one.
Check my answer here: notifyicon image looks terrible once image ends up in system tray
Basically, you need to explicitly declare which size to use at runtime, and to declare your app as DPI-Aware.

Strange distortion with higher-quality notification bar icon

I recently decided to create a higher quality graphic for an application I develop. The original, and lower quality, graphic is 48x48 pixels, and the new one is 256x256 pixels. When I run the older version of the application, with its lower resolution icon, the icon displays properly.
However, when running the new application the higher resolution icon the icon is distorted (square with sharp edges rather than rounded ones, and the icon is off at an angle).
Looks like a poor sampling function is used to rescale the icon.
While there are more elegant solutions, 256 px to 48 px is a pretty drastic resize. Why not simply make a second, smaller resolution icon, and use that for the tray?
I played around with your image a bit, and this is the best I could do:
You can copy and paste it into a 16px 24 bit icon in your resource manager (don't forget to "Clean" your solution rebuild as it may still use the old one), instead of the big one you are using. I made it by shrinking your icon to 16x16 and then hand-editing the pixels until it looked right:
If you need a high-res icon somewhere else, I think you should have one high-res and one lo-res icon and use whichever is appropriate.
Simply having one icon and rescaling it to different sizes sounds like a clever thing to do, but in practice you can't simply rescale icons and expect it to work: http://mrgan.tumblr.com/post/708404794/ios-app-icon-sizes

What are the exact dimensions for a Windows application icon

There are different dimensions for taskbar(big icons, small), desktop, start menu, etc. What are all dimensions one needs for a Windows application? And is there a way to put them all into a single file?
I have already designed the icon in Photoshop.
Well, the desktop alone can use almost any standard (Joey named most, if not all, of them) size.
I find it works well to combine 16x16, 32x32, 48x48, and 256x256 (and maybe more sizes) into one .ico file. I use IcoFx, and it is super easy to create multi-size icons from one 256x256 image.
Icon files (.ico) can contain variaous sizes. Common sizes for icons on Windows are:
16×16 (e.g. in the notification area of the taskbar or in default settings for the system menu of an application). This often shows a different icon than the other sizes due to the small area, e.g. perspective is often left out (which is in the recommendations for icons as well, if I remember correctly).
24×24
32×32 (e.g. in the taskbar unless small icons are configured for it)
48×48
64×64
128×128
256×256
If a size is missing then a larger one will be used to downsample the image or, if no larger one is present, a smaller one will be upsampled (with quality loss). The different sizes are thus not particular important except to provide the artist some control over the icon in standard sizes (it's not uncommon to have the icon in a vector format and edit the rasterised version in various sizes so they look good in all of them).
The uses mentioned above are approximate and depend on various things, e.g. the user's DPI setting.

Categories