You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The issue is with how the icon is loaded and drawn. The method addIcons loads the icon using OS.LoadIconMetric (OS.GetLibraryHandle (), searchIconResource, 1, phicon). Here there is no reference provided to what size the image is going to be loaded for neither does the OS know for what monitor it is loaded. I tested this with my primary monitor set to 200 and 100 and for both I get the icon of different sizes, 28x28 and 20x20 respectively. So, one thing is for certain that this method loads the icon accordign to the primary monitor zoom level. Refer: https://learn.microsoft.com/en-us/windows/win32/api/commctrl/nf-commctrl-loadiconmetric
Now this icon is later on drawn in the method WM_DRAWITEM. The drawing call is like this: OS.DrawIconEx (struct.hDC, 0, y, hIcon, side, side, 0, 0, OS.DI_NORMAL);
The documentation says, with this call, it will draw the image in the size in which it was loaded (default). So, that's why there is no scaling. Refer: https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-drawiconex
However, I have implemented a fix for this and that has a little to do with how the icon is loaded since it is independent of what window it is going to be drawn on. Rather, when we are drawing it, we should calculate the bounds of the image and scale it up.
Here's how it looks when the image is scaled down from 200 to 100:
The icons (IDI_SEARCH, IDI_CANCEL, ...) are not scaled on dpi change, e.g. visible in the Error Log or the Preferences Dialog
The text was updated successfully, but these errors were encountered: