diff --git a/include/wx/msw/combo.h b/include/wx/msw/combo.h index c5b27687d7..f30bc1a309 100644 --- a/include/wx/msw/combo.h +++ b/include/wx/msw/combo.h @@ -94,6 +94,8 @@ protected: void OnPaintEvent( wxPaintEvent& event ); void OnMouseEvent( wxMouseEvent& event ); + virtual bool HasTransparentBackground() { return IsDoubleBuffered(); } + private: void Init(); diff --git a/src/msw/combo.cpp b/src/msw/combo.cpp index b85366b78c..1e59def4d8 100644 --- a/src/msw/combo.cpp +++ b/src/msw/combo.cpp @@ -202,15 +202,18 @@ bool wxComboCtrl::Create(wxWindow *parent, if ( style & wxCC_STD_BUTTON ) m_iFlags |= wxCC_POPUP_ON_MOUSE_UP; + // Prepare background for double-buffering or better background theme + // support, whichever is possible. + SetDoubleBuffered(true); + if ( !IsDoubleBuffered() ) + SetBackgroundStyle( wxBG_STYLE_PAINT ); + // Create textctrl, if necessary CreateTextCtrl( wxNO_BORDER ); // Add keyboard input handlers for main control and textctrl InstallInputHandlers(); - // Prepare background for double-buffering - SetBackgroundStyle( wxBG_STYLE_CUSTOM ); - // SetInitialSize should be called last SetInitialSize(size); @@ -434,7 +437,8 @@ void wxComboCtrl::OnPaintEvent( wxPaintEvent& WXUNUSED(event) ) // TODO: Convert drawing in this function to Windows API Code wxSize sz = GetClientSize(); - wxAutoBufferedPaintDC dc(this); + wxDC* dcPtr = wxAutoBufferedPaintDCFactory(this); + wxDC& dc = *dcPtr; const wxRect& rectButton = m_btnArea; wxRect rectTextField = m_tcArea; @@ -640,6 +644,8 @@ void wxComboCtrl::OnPaintEvent( wxPaintEvent& WXUNUSED(event) ) else wxComboPopup::DefaultPaintComboControl(this,dc,rectTextField); } + + delete dcPtr; } void wxComboCtrl::OnMouseEvent( wxMouseEvent& event )