Check mark of `wxBoolProperty` looks blurry at high DPI (Issue #24651)

36 views
Skip to first unread message

taler21

unread,
Jun 28, 2024, 7:54:06 AM (7 days ago) Jun 28
to wx-...@googlegroups.com, Subscribed

As can be seen in the propgrid sample, the check mark of a wxBoolProperty looks sharp at 100% DPI scaling but blurry at 200% and 300%.

wxBoolProperty-check-mark-100-200-300-DPI-scaling.png (view on web)

The check mark of a wxCheckBox looks sharp even at 300% DPI scaling.

wxCheckBox-check-mark-300-DPI-scaling.png (view on web)

Platform and version information

  • wxWidgets version you use: 3.2.5
  • wxWidgets port you use: wxMSW
  • OS and its version: Windows 10


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/24651@github.com>

dsa-t

unread,
Jun 28, 2024, 12:02:51 PM (7 days ago) Jun 28
to wx-...@googlegroups.com, Subscribed

I haven't looked yet, but could there be some downscaling happening?

In that case, #24567 should help.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/24651/2197234920@github.com>

dsa-t

unread,
Jun 28, 2024, 7:10:55 PM (7 days ago) Jun 28
to wx-...@googlegroups.com, Subscribed

The actual drawn checkbox size is different to the rect that wx passes to DrawThemeBackground.

DrawThemeBackground Actual Scale
15x15 13x13 100%
20x20 16x16 (if DPI changed from 100%) 125%
20x20 20x20 (if DPI didn't change) 125%


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/24651/2197758330@github.com>

dsa-t

unread,
Jun 28, 2024, 7:42:16 PM (7 days ago) Jun 28
to wx-...@googlegroups.com, Subscribed

Here are best checkbox sizes for different scales on Win11:

100%: 13
125%: 16
150%: 20
175%: 20

200%: 26
225%: 26
250%: 32

300%: 40
350%: 40


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/24651/2197773368@github.com>

dsa-t

unread,
Jun 28, 2024, 9:51:56 PM (6 days ago) Jun 28
to wx-...@googlegroups.com, Subscribed

Seems to be working correctly with this patch:

diff --git a/src/msw/renderer.cpp b/src/msw/renderer.cpp
index 2a8d013b31..31e884142f 100644
--- a/src/msw/renderer.cpp
+++ b/src/msw/renderer.cpp
@@ -716,7 +716,18 @@ wxRendererXP::DoDrawXPButton(int kind,
     if ( !hTheme )
         return false;
 
-    DoDrawButtonLike(hTheme, kind, dc, rect, flags);
+    wxRect crect = rect;
+
+    if ( kind == BP_CHECKBOX )
+    {
+        if ( ::IsThemePartDefined(hTheme, kind, 0) )
+        {
+            crect = wxRect(hTheme.GetDrawSize(kind, CBS_UNCHECKEDNORMAL));
+            crect.MakeCenteredIn(rect);
+        }
+    }
+
+    DoDrawButtonLike(hTheme, kind, dc, crect, flags);
 
     return true;
 }

Maybe makes sense to apply to BP_RADIOBUTTON as well.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/24651/2197845277@github.com>

taler21

unread,
Jul 1, 2024, 2:58:00 AM (4 days ago) Jul 1
to wx-...@googlegroups.com, Subscribed

Thanks for looking at this.

I can confirm that with your changes applied, it looks correct.

wxBoolProperty-check-mark-patched.png (view on web)


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/24651/2199382540@github.com>

dsa-t

unread,
Jul 3, 2024, 9:44:47 AM (2 days ago) Jul 3
to wx-...@googlegroups.com, Subscribed

PR: #24671


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/24651/2206114344@github.com>

Reply all
Reply to author
Forward
0 new messages