git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37814
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
it.cchTextMax = WXSIZEOF(text);
ListView_GetItem(hwndList, &it);
it.cchTextMax = WXSIZEOF(text);
ListView_GetItem(hwndList, &it);
+ HIMAGELIST himl = ListView_GetImageList(hwndList, LVSIL_SMALL);
+ if ( himl && ImageList_GetImageCount(himl) )
- HIMAGELIST himl = ListView_GetImageList(hwndList, LVSIL_SMALL);
-
- ImageList_Draw(himl, it.iImage, hdc, rc.left, rc.top,
- nmcd.uItemState & CDIS_SELECTED ? ILD_SELECTED
- : ILD_TRANSPARENT);
+ if ( it.iImage != -1 )
+ {
+ ImageList_Draw(himl, it.iImage, hdc, rc.left, rc.top,
+ nmcd.uItemState & CDIS_SELECTED ? ILD_SELECTED
+ : ILD_TRANSPARENT);
+ }
+ // notice that even if this item doesn't have any image, the list
+ // control still leaves space for the image if the image list is not
+ // empty (presumably so that items with and without images align?)
int wImage, hImage;
ImageList_GetIconSize(himl, &wImage, &hImage);
int wImage, hImage;
ImageList_GetIconSize(himl, &wImage, &hImage);