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.
This commit is contained in:
Vadim Zeitlin
2017-12-24 19:54:41 +01:00
parent 3ff9846a22
commit 36c4b7651e

View File

@@ -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;