diff --git a/src/msw/combo.cpp b/src/msw/combo.cpp index 51bad16e5c..f6c705008c 100644 --- a/src/msw/combo.cpp +++ b/src/msw/combo.cpp @@ -420,6 +420,8 @@ void wxComboCtrl::OnPaintEvent( wxPaintEvent& WXUNUSED(event) ) { // TODO: Convert drawing in this function to Windows API Code + const bool useVistaComboBox = ::wxGetWinVersion() >= wxWinVersion_Vista; + wxSize sz = GetClientSize(); wxDC* dcPtr = wxAutoBufferedPaintDCFactory(this); wxDC& dc = *dcPtr; @@ -428,6 +430,14 @@ void wxComboCtrl::OnPaintEvent( wxPaintEvent& WXUNUSED(event) ) wxRect rectTextField = m_tcArea; wxColour bgCol = GetBackgroundColour(); + // FIXME: Either SetBackgroundColour or GetBackgroundColour + // doesn't work under Vista, so here's a temporary + // workaround. + // In the theme-less rendering code below, this fixes incorrect + // background on read-only comboboxes (they are gray, but should be + // white). + bgCol = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW); + #if wxUSE_UXTHEME const bool isEnabled = IsThisEnabled(); @@ -455,8 +465,6 @@ void wxComboCtrl::OnPaintEvent( wxPaintEvent& WXUNUSED(event) ) #if wxUSE_UXTHEME if ( hTheme ) { - const bool useVistaComboBox = ::wxGetWinVersion() >= wxWinVersion_Vista; - RECT rFull; wxCopyRectToRECT(borderRect, rFull); @@ -502,11 +510,6 @@ void wxComboCtrl::OnPaintEvent( wxPaintEvent& WXUNUSED(event) ) if ( useVistaComboBox ) { - // FIXME: Either SetBackgroundColour or GetBackgroundColour - // doesn't work under Vista, so here's a temporary - // workaround. - bgCol = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW); - // Draw the entire control as a single button? if ( !isNonStdButton ) {