Taskbar ugly icon in WPF application

前端 未结 3 681
醉梦人生
醉梦人生 2021-02-14 15:41

The icon in the taskbar is looking very ugly in my WPF application.

The designer sent me some PNGs like:

32x32, 64x64, 96x96, 128x128, 192x192, 256x256, 512x512

3条回答
  •  北海茫月
    2021-02-14 15:58

    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 down.

    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.

提交回复
热议问题