X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/93fbbe07650f0f5b47a162081160007b4d9e3b87..3f4a2351e4c677c88c18ea812b609477adee7380:/src/msw/control.cpp?ds=sidebyside 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; }