From: Vadim Zeitlin Date: Wed, 18 May 2005 23:18:18 +0000 (+0000) Subject: make sure that setting custom foreground works together with custom background too X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/3d2f4457ad3fc8e02e7d7fee8c842c725f7c27ae?ds=inline make sure that setting custom foreground works together with custom background too git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34152 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/msw/control.cpp b/src/msw/control.cpp index ce27473f21..8b27babb06 100644 --- a/src/msw/control.cpp +++ b/src/msw/control.cpp @@ -339,10 +339,6 @@ WXHBRUSH wxControl::DoMSWControlColor(WXHDC pDC, wxColour colBg, WXHWND hWnd) { ::SetTextColor(hdc, wxColourToRGB(GetForegroundColour())); } - else - { - ::SetTextColor(hdc, ::GetSysColor(COLOR_WINDOWTEXT)); - } WXHBRUSH hbr = 0; if ( !colBg.Ok() ) @@ -365,6 +361,13 @@ WXHBRUSH wxControl::DoMSWControlColor(WXHDC pDC, wxColour colBg, WXHWND hWnd) wxBrush *brush = wxTheBrushList->FindOrCreateBrush(colBg, wxSOLID); hbr = (WXHBRUSH)brush->GetResourceHandle(); + + // if we use custom background, we should set foreground ourselves too + if ( !m_hasFgCol ) + { + ::SetTextColor(hdc, ::GetSysColor(COLOR_WINDOWTEXT)); + } + //else: already set above } return hbr;