From 25e6a4a698b15d72874bd1dbf4d260163a60f005 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 5 Mar 2006 12:12:11 +0000 Subject: [PATCH] another custom draw fix: leave space for the image even if the current item doesn't have any but the list control has an image list (because this is what the standard drawing procedure does) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37814 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/listctrl.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/msw/listctrl.cpp b/src/msw/listctrl.cpp index 410219a869..2406e000c1 100644 --- a/src/msw/listctrl.cpp +++ b/src/msw/listctrl.cpp @@ -2409,14 +2409,19 @@ static void HandleSubItemPrepaint(LPNMLVCUSTOMDRAW pLVCD, HFONT hfont) it.cchTextMax = WXSIZEOF(text); ListView_GetItem(hwndList, &it); - if ( it.iImage != -1 ) + 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); -- 2.45.2