diff --git a/src/msw/bmpcbox.cpp b/src/msw/bmpcbox.cpp index 35665f61d5..124b9b78f1 100644 --- a/src/msw/bmpcbox.cpp +++ b/src/msw/bmpcbox.cpp @@ -481,22 +481,30 @@ bool wxBitmapComboBox::MSWOnDraw(WXDRAWITEMSTRUCT *item) if ( lpDrawItem->itemState & ODS_SELECTED ) flags |= wxODCB_PAINTING_SELECTED; + wxPaintDCEx dc(this, lpDrawItem->hDC); + wxRect rect = wxRectFromRECT(lpDrawItem->rcItem); + wxBitmapComboBoxBase::DrawBackground(dc, rect, pos, flags); + wxString text; if ( flags & wxODCB_PAINTING_CONTROL ) { - text = GetValue(); + // Don't draw anything in the editable selection field. if ( !HasFlag(wxCB_READONLY) ) - text.clear(); + return true; + + pos = GetSelection(); + // Skip drawing if there is nothing selected. + if ( pos < 0 ) + return true; + + text = GetValue(); } else { text = GetString(pos); } - wxPaintDCEx dc(this, lpDrawItem->hDC); - wxRect rect = wxRectFromRECT(lpDrawItem->rcItem); - wxBitmapComboBoxBase::DrawBackground(dc, rect, pos, flags); wxBitmapComboBoxBase::DrawItem(dc, rect, pos, text, flags); // If the item has the focus, draw focus rectangle.