diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index 985fa5d7e9..8c40c96c48 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -5088,7 +5088,17 @@ void wxGenericListCtrl::SetSingleStyle( long style, bool add ) else flag &= ~style; - SetWindowStyleFlag( flag ); + // some styles can be set without recreating everything (as happens in + // SetWindowStyleFlag() which calls wxListMainWindow::DeleteEverything()) + if ( !(style & ~(wxLC_HRULES | wxLC_VRULES)) ) + { + Refresh(); + wxWindow::SetWindowStyleFlag(flag); + } + else + { + SetWindowStyleFlag( flag ); + } } void wxGenericListCtrl::SetWindowStyleFlag( long flag )