From e4dcc4850ce472846a3f785587042392328362d9 Mon Sep 17 00:00:00 2001 From: Steve Browne Date: Wed, 19 Feb 2020 09:16:21 -0500 Subject: [PATCH] Fix wxStaticBox appearance in high DPI in wxMSW wxStaticBox using custom foreground color was drawing text in wrong place when using DPI scaling due to scaling the various offsets in our code, even though Windows itself doesn't do it. Fix this by following what Windows does and not scaling anything. Closes https://github.com/wxWidgets/wxWidgets/pull/1738 --- src/msw/statbox.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/msw/statbox.cpp b/src/msw/statbox.cpp index c1d82350a3..ff8ba89ed5 100644 --- a/src/msw/statbox.cpp +++ b/src/msw/statbox.cpp @@ -550,15 +550,16 @@ void wxStaticBox::PaintForeground(wxDC& dc, const RECT&) // first we need to correctly paint the background of the label // as Windows ignores the brush offset when doing it - const int x = FromDIP(LABEL_HORZ_OFFSET); + // NOTE: Border intentionally does not use DIPs in order to match native look + const int x = LABEL_HORZ_OFFSET; RECT dimensions = { x, 0, 0, height }; dimensions.left = x; dimensions.right = x + width; // need to adjust the rectangle to cover all the label background - dimensions.left -= FromDIP(LABEL_HORZ_BORDER); - dimensions.right += FromDIP(LABEL_HORZ_BORDER); - dimensions.bottom += FromDIP(LABEL_VERT_BORDER); + dimensions.left -= LABEL_HORZ_BORDER; + dimensions.right += LABEL_HORZ_BORDER; + dimensions.bottom += LABEL_VERT_BORDER; if ( UseBgCol() ) {