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.
Related
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.
How can I make my Windows Store App look great on large resolutions? For example a Button - how can I change its font size based on the resolution? If I view my app on 13" the button looks OK, but if I view it on 27" display it looks very, very small. Isn't something to be used in the Windows store apps framework to adapt a button, textBlock, etc to the screen resolution?
Set StretchDirection="Both" & StretchProperty="Fill" in ViewBox
This is a consequence of screen scaling based on DPI... which makes your button the same physical size on both monitors, but totally ignores the fact that the user sits/stands much closer to one than the other. Maybe someday we'll have a not-stupid scaling scheme that works based on subtended angles.
Large format monitors already have larger pixels, I suggest you simply opt out of display scaling in your application. (But do respect the global system font size settings)
I'm not sure what the opt-out setting is in XAML (WPF), but in WinForms, I'd be changing the AutoScaleMode property.
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
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.
i'm developping an application in CF 3.5 for windows Mobile 6 Pro using C# and i have a little issue requiring the advice of someone that knows better.
Basically, i want my application to run and scale on multiple device sizes and resolutions. Eveything scales properly but the images.
Some images that are for example 16X16 will look very small on a high resolution screen, so I want to display a 32X32 image, but I don't know what's the best way to decide which image size to display.
I have the option to check the dpi and then manually choose which image to display, but it seems like dirty work.
Isn't there any way to do it otherwise or what's the best way to do it?
I recommend that you create a layer between your forms and the images. Create a new class that would be responsible for returning the correct sized image. The code in your forms will rely on that to get the image and would have to know nothing about the sizes. For example:
mypicturebox.Image = ImageFactory.Image01;
The good thing is that you can use any technique you want inside the ImageFactory without affecting the rest of the code. The easiest thing to do is to check the size of the screen (using Screen.PrimaryScreen.WorkingArea) and do a manual decision.