X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/008881c3f0ccbbc6d2b73fd9151c85ea243f88b1..ec5f0c24123fe801fb82b69771c171c0b9d064fc:/src/msw/stattext.cpp diff --git a/src/msw/stattext.cpp b/src/msw/stattext.cpp index 124d9e471d..466fb5484d 100644 --- a/src/msw/stattext.cpp +++ b/src/msw/stattext.cpp @@ -126,6 +126,27 @@ WXDWORD wxStaticText::MSWGetStyle(long style, WXDWORD *exstyle) const return msStyle; } +WXHBRUSH wxStaticText::DoMSWControlColor(WXHDC pDC, wxColour colBg) +{ + // If this control has a non-standard fg colour but still has the standard + // bg then we need to also give it a non-standard bg otherwise the fg + // setting has no effect. + WXHBRUSH hbr = wxControl::DoMSWControlColor(pDC, 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; +} + wxSize wxStaticText::DoGetBestSize() const { wxClientDC dc(wx_const_cast(wxStaticText *, this));