X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/93fbbe07650f0f5b47a162081160007b4d9e3b87..e69d5138dc8f95e294ae6d03beb4f321406f4e34:/src/msw/control.cpp diff --git a/src/msw/control.cpp b/src/msw/control.cpp index 73a8f2511a..9817456107 100644 --- a/src/msw/control.cpp +++ b/src/msw/control.cpp @@ -29,6 +29,7 @@ #include "wx/control.h" #ifndef WX_PRECOMP + #include "wx/msw/wrapcctl.h" // include "properly" #include "wx/event.h" #include "wx/app.h" #include "wx/dcclient.h" @@ -47,9 +48,6 @@ #include "wx/msw/private.h" #include "wx/msw/uxtheme.h" -// include "properly" -#include "wx/msw/wrapcctl.h" - // ---------------------------------------------------------------------------- // wxWin macros // ---------------------------------------------------------------------------- @@ -384,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; }