Check box of non-selected `wxBoolProperty` is not vertically centered at high DPI (Issue #24650)

26 views
Skip to first unread message

taler21

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

At high DPI, the check box of a wxBoolProperty is not vertically centered unless the property is the selected one.
So the vertical position of the check box differs depending on whether the wxBoolProperty is selected in the wxPropertyGrid or not.

The issue can also be seen in the propgrid sample.

wxBoolProperty-check-box-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/24650@github.com>

dsa-t

unread,
Jul 3, 2024, 9:01:38 PM (2 days ago) Jul 3
to wx-...@googlegroups.com, Subscribed

Something like this (on top of #24671) seems to be working:

diff --git a/src/propgrid/editors.cpp b/src/propgrid/editors.cpp
index 9dfc565e5f..da6d2e93c1 100644
--- a/src/propgrid/editors.cpp
+++ b/src/propgrid/editors.cpp
@@ -1555,7 +1555,7 @@ public:
         // Due to SetOwnFont stuff necessary for GTK+ 1.2, we need to have this
         wxControl::SetFont( parent->GetFont() );
 
-        SetBoxHeight(12);
+        SetBoxHeight(13);
         wxControl::SetBackgroundStyle( wxBG_STYLE_PAINT );
     }
 
@@ -1565,10 +1565,7 @@ public:
     {
         m_boxHeight = height;
         // Box rectangle
-        wxRect rect(GetClientSize());
-        rect.y += 1;
-        rect.width += 1;
-        m_boxRect = GetBoxRect(rect, m_boxHeight);
+        m_boxRect = GetBoxRect(GetClientSize(), m_boxHeight);
     }
 
     static wxRect GetBoxRect(const wxRect& r, int box_h)
diff --git a/src/propgrid/property.cpp b/src/propgrid/property.cpp
index 41b45f8f4d..f9166b9681 100644
--- a/src/propgrid/property.cpp
+++ b/src/propgrid/property.cpp
@@ -86,7 +86,7 @@ void wxPGCellRenderer::DrawEditorValue( wxDC& dc, const wxRect& rect,
     {
         wxRect rect2(rect);
         rect2.Offset(xOffset, yOffset);
-        rect2.height -= yOffset;
+        rect2.height -= yOffset * 2;
         editor->DrawValue( dc, rect2, property, text );
     }
     else


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/24650/2207738034@github.com>

taler21

unread,
Jul 4, 2024, 2:52:15 AM (yesterday) Jul 4
to wx-...@googlegroups.com, Subscribed

Yes, with these changes it works correctly. Thanks!


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/24650/2208244928@github.com>

Reply all
Reply to author
Forward
0 new messages