Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TaskBarIcon is blurry compared to AppWindow.SetIcon #68

Open
mikebattista opened this issue Jul 14, 2022 · 2 comments
Open

TaskBarIcon is blurry compared to AppWindow.SetIcon #68

mikebattista opened this issue Jul 14, 2022 · 2 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@mikebattista
Copy link

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?

var handle = PInvoke.LoadImage(null, filename, GDI_IMAGE_TYPE.IMAGE_ICON, 16, 16, Windows.Win32.UI.Controls.IMAGE_FLAGS.LR_LOADFROMFILE);

@sylveon
Copy link

sylveon commented Sep 13, 2023

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
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants