dotMorten / WinUIEx

WinUI Extensions
https://dotmorten.github.io/WinUIEx
MIT License
615 stars 40 forks source link

TaskBarIcon is blurry compared to AppWindow.SetIcon #68

Open mikebattista opened 2 years ago

mikebattista commented 2 years ago

With a 256x256 .ico, AppWindow.SetIcon results in a sharp taskbar icon while setting TaskBarIcon in XAML or with Icon.FromFile results in a blurry icon.

Could the 16x16 dimensions provided below be to blame?

https://github.com/dotMorten/WinUIEx/blob/8c84bc9bf0c4c07c71e9724bb1434998ade82a5c/src/WinUIEx/Icon.cs#L47

sylveon commented 1 year ago

The proper method to use would be LoadIconMetric, for both large and small icons. This should make it DPI aware as well. Alternatively, WinUIEx could migrate to AppWindow.SetIcon of course.

rocksdanister commented 1 year ago

Can you not pass the large icon size by using GetSystemMetricsForDpi

or use LoadIconMetric this will require adding to the manifest

    <dependentAssembly>
      <assemblyIdentity
          type="win32"
          name="Microsoft.Windows.Common-Controls"
          version="6.0.0.0"
          processorArchitecture="*"
          publicKeyToken="6595b64144ccf1df"
          language="*"
        />
    </dependentAssembly>
  </dependency>

Original:

image

GetSystemMetric:

Screenshot 2023-09-13 150229

LoadIconMetric with smallicon (can't get large to work 🤔)

Screenshot 2023-09-13 150303