From 36c4b7651e83752745c1e10f6fe3d742b2ef9942 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 24 Dec 2017 19:54:41 +0100 Subject: [PATCH] Fix background of wxCheckBoxes inside wxStaticBox in wxMSW Erase background of the partially transparent native child controls, such as wxCheckBox, using our own background colour if we have it instead of using the parent's colour. For some reason, we -- seemingly intentionally, judging from the comment -- didn't do it before, but this meant that checkboxes inside static boxes didn't inherit the box background colour, if it was set, which was ugly and inconsistent with at least wxGTK. So do use our own background if we have it now by just reusing the existing PaintBackground() instead of manually using the parent background brush in WM_PRINTCLIENT handler. --- src/msw/statbox.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/msw/statbox.cpp b/src/msw/statbox.cpp index a178c4abcb..6596e1b573 100644 --- a/src/msw/statbox.cpp +++ b/src/msw/statbox.cpp @@ -204,9 +204,10 @@ WXLRESULT wxStaticBox::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lPar if ( !HandlePrintClient((WXHDC)wParam) ) { // no, we don't, erase the background ourselves - // (don't use our own) - see PaintBackground for explanation - wxBrush brush(GetParent()->GetBackgroundColour()); - wxFillRect(GetHwnd(), (HDC)wParam, GetHbrushOf(brush)); + RECT rc; + ::GetClientRect(GetHwnd(), &rc); + wxDCTemp dc((WXHDC)wParam); + PaintBackground(dc, rc); } return 0;