Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wrong sized icon showing up in Windows taskbar for WPF app

I have a simple WPF app. I have a nice multi-res icon with sizes all the way from 256x256 down to 16x16. All the usual stuff.

My app looks awesome in Windows Explorer, the icon looks awesome, even at Extra Large view. The icons scale nicely and I see the appropriate icon for the appropriate resolution.

However, the 48x48 is always used for the pinned taskbar or pinned start menu and it looks awful.

I can't find anything about this in the usual locations, but my gut says that someone must know something and I'm just missing something obvious.

like image 382
Scott Hanselman Avatar asked May 21 '14 05:05

Scott Hanselman


People also ask

Why did my taskbar icons get smaller?

You can actually change this via the Settings. Right click on the Taskbar and select Taskbar Settings. It should bring you to Personalization window and select the Taskbar tab. Make sure to turn off the "Use small taskbar buttons."


2 Answers

Taskbar icons seem to get blurry as soon as a 48x48 pixels version is included in the .ico file. Instead of picking the correctly sized 32x32 pixels version, for some reason Windows apparently picks the 48x48 one and scales it up.

The solution for me is to use two separate icon files:

  • One .ico containing 24x24 and 32x32 versions of the icon, which will, when set as a Window's icon using the Icon property in XAML or Hannish's approach, be used for the titlebar and taskbar respectively - without unwanted scaling.
  • A second icon file containing - depending on which sources are right - a range of sizes between 16x16 and 256x256 pixels. Setting this one as the application icon in the project properties will make the icon look good in all the other places like the desktop and the file explorer on different view settings.

Testing on Windows 10, this seems to cover the following display cases: taskbar, window titlebar, Alt-TAB menu, Desktop and file explorer.

like image 75
Joe Bloe Avatar answered Sep 30 '22 17:09

Joe Bloe


The icon size that is displayed in your taskbar is determined by a variety of factors; 'MinWidth' value of HKEY_CURRENT_USER|Control Panel|Desktop|WindowMetrics, DPI settings, and taskbar settings.

48x48 is chosen because the default 'MinWidth' setting is (i believe) 53, and the 48x48 is the largest resolution in your icon that fits within that setting.

if you are unhappy with the way the 48x48 icon looks, it may just need re-designed. Be sure it is using the correct number of colors, etc. How do the small icons look? As bad or worse than the 48x48? if so, then perhaps the icon is too complex to look good at such a small resolution.

I know of no way to force windows to select a different icon size for the taskbar.

like image 26
tooslow Avatar answered Sep 30 '22 17:09

tooslow