From 155acb0cc9ae03c575c1a5e1cd55041d245361b6 Mon Sep 17 00:00:00 2001
From: Julian Smart <julian@anthemion.co.uk>
Date: Fri, 15 Sep 2006 19:46:50 +0000
Subject: [PATCH] If we use a background brush, we _must_ set a colour (fixes a
 bug with static labels not showing on a panel with a black background when
 system colours are high-contrast)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41241 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---
 src/msw/control.cpp | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/msw/control.cpp b/src/msw/control.cpp
index 6572a219c0..9817456107 100644
--- a/src/msw/control.cpp
+++ b/src/msw/control.cpp
@@ -382,14 +382,15 @@ WXHBRUSH wxControl::DoMSWControlColor(WXHDC pDC, wxColour colBg, WXHWND hWnd)
 
         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
     }
 
+    // if we use custom background, we should set foreground ourselves too
+    if ( hbr && !m_hasFgCol )
+    {
+        ::SetTextColor(hdc, ::GetSysColor(COLOR_WINDOWTEXT));
+    }
+    //else: already set above
+
     return hbr;
 }
 
-- 
2.47.2