-
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
Downscaling from the maximum icon size instead of picking the correct icon size from an icon package (.ico file). #75
Comments
What happens if the .ico file does not contain the required size(after your PR)? |
This is not a bug, if there isn't an icon to pick the only option is downscaling the next. |
Sorry for the delay, last Friday my family and me had gotten covid, and having a 6yo kid keeps you occupied... I never wanted to close the issue already, as I know there are some additional things to do. We should write down what we want / expect etc. I think there is always room for improvement, it's not hard to read the .ico file ourselves and select the best option. Also do not that one needs to enable dpi-awareness for their app to get some of the special features. |
FYI this is how I pick an icon and give it to NotifyIcon at the moment: var desiredSize = System.Windows.Forms.SystemInformation.SmallIconSize.Width;
var avaliableSizes = new[] { 64, 48, 40, 32, 24, 20, 16 };
var nearest = avaliableSizes.OrderBy(x => Math.Abs(x - desiredSize)).First();
var icon = new Icon(IconStream, new System.Drawing.Size(nearest, nearest));
notifyIcon.Icon = icon; The current committed fix for this (3672b4e) only attempts to address the problem when the icon is set through I am not sure what can (or should) be done if someone passes in the wrong GDI icon. Eg. |
This commit fixed an issue where, in a Windows UI at 100% scale, an icon that had a 16x16 version was 32x32 scaled down to 16x16 instead of the existing 16x16 version in the same ICO file. But now it ignores the Windows UI scaling fact, if you choose 125% or 150% the icon will stay at 16x16. Can it be fixed in the some way? |
Just for reminder: To get the scaling factor: PresentationSource source = PresentationSource.FromVisual(someVisual);
double scaleX, scaleY;
if (source != null) {
scaleX = source.CompositionTarget.TransformToDevice.M11;
scaleY = source.CompositionTarget.TransformToDevice.M22;
} or this |
I have an icon package with icons of 3 sizes: 64x64, 32x32, 16x16, the icon must be 16x16 in my case, but is always picked an icon with a higher resolution then downscaled to 16x16, even if i have added explicitly a 16x16 icon.
The downscaling degrades my icon, making it blurry, for example my 16x16 uses a cross of 1 pixel, but it displays a wrong downscaled icon that has a blurry 2 pixel cross.
The only solution is to use a .ico file with only a 16x16 icon size, but this way doesn't support monitors with higher resolution that will upscale the 16x16.
The text was updated successfully, but these errors were encountered: