Fixed displaying text labels after assigning wxImageList to wxListCtrl.

For ComCtl32 prior to 6.0 all text labels in wxListCtrl need to be re-assigned when new wxImageList is set in order to position them correctly within the control.
This commit is contained in:
Artur Wieczorek 2016-02-16 21:36:44 +01:00
parent 53b6806b50
commit 43fe885eb7

View File

@ -1341,6 +1341,18 @@ void wxListCtrl::SetImageList(wxImageList *imageList, int which)
m_ownsImageListState = false; m_ownsImageListState = false;
} }
(void) ListView_SetImageList(GetHwnd(), (HIMAGELIST) imageList ? imageList->GetHIMAGELIST() : 0, flags); (void) ListView_SetImageList(GetHwnd(), (HIMAGELIST) imageList ? imageList->GetHIMAGELIST() : 0, flags);
// For ComCtl32 prior 6.0 we need to re-assign all existing
// text labels in order to position them correctly.
if ( wxApp::GetComCtl32Version() < 600 )
{
const int n = GetItemCount();
for( int i = 0; i < n; i++ )
{
wxString text = GetItemText(i);
SetItemText(i, text);
}
}
} }
void wxListCtrl::AssignImageList(wxImageList *imageList, int which) void wxListCtrl::AssignImageList(wxImageList *imageList, int which)