-
Notifications
You must be signed in to change notification settings - Fork 132
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
Fixed #75: Pick the correct size of the icon from a .ico file. #76
Conversation
I think is because net 4.5 is not supported anymore by microsoft and azure... |
Hey, thank you for your contribution! I had a quick look, mainly looking at the change and ignoring the 4.5 error (I think we can drop the support). Instead of using the SystemParameters.SmallIconWidth and SystemParameters.SmallIconHeight it might make more sense to query them via: GetSystemMetricsForDpi using SM_CXSMICON This also means we need to pass the DPI for the screen where the icon is visible, I currently do not recall if we have that information at hand. I know I did do some DPI stuff, but I jump back and forth between projects... |
Maybe something likes that? |
Not exactly, as this doesn't use the Windows 10 APIs to get the current DPI.
(untested code, don't have access to VS right now) |
…e current dpi factor.
I've added a way to get from CXSMICON and CYSMICON. For me both the ways give me the same value
|
I just noticed that you are targeting the master branch, which is not your fault but I guess we should make develop the default. It doesn't make sense to target master (which reminds me that I wanted to rename it) please target develop, so you will not need to bring the code from develop over to master. |
Ah yes, I cannot change the default branch, there is that 🤷♂️ Hi @hardcodet, can you please change the default branch to develop, so the PRs we get do not go to older branches? |
@Lakritzator Done :) |
I don't have noticed the wrong branch, thanks for fixing. |
As explained in #75, if a .ico file with multiple icons is used, the wrong size of the icon is picked and downscaled to the requested size.
This PR fixed that problem by sending the requested icon size when creating the icon.
Downscaled wrong icon:
Right icon:
Tested on Windows 11 with .NET 6.0.