From 30a224112742357fa240cf0e196bbc05b60ff242 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Mon, 14 Mar 2005 17:09:00 +0000 Subject: [PATCH] If the parents are nothing but a panel and a frame then MSWGetBgBrushForChild will still return NULL. Fallback to a solid background colour in this case. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32820 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/stattext.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/msw/stattext.cpp b/src/msw/stattext.cpp index 518a7677fd..466fb5484d 100644 --- a/src/msw/stattext.cpp +++ b/src/msw/stattext.cpp @@ -135,6 +135,14 @@ WXHBRUSH wxStaticText::DoMSWControlColor(WXHDC pDC, wxColour colBg) if (!hbr && m_hasFgCol) { hbr = MSWGetBgBrushForChild(pDC, this); + if (!hbr) + { + HDC hdc = (HDC)pDC; + wxColour bg = GetBackgroundColour(); + ::SetBkColor(hdc, wxColourToRGB(bg)); + wxBrush *brush = wxTheBrushList->FindOrCreateBrush(bg, wxSOLID); + hbr = (WXHBRUSH)brush->GetResourceHandle(); + } } return hbr; } -- 2.50.0