From 51c28613b2402cb3481fcda987f232eb84cf896d Mon Sep 17 00:00:00 2001 From: juha Date: Mon, 28 Dec 2015 13:32:14 +0000 Subject: [PATCH] LCL-Win32: Fix drag and drop issue of ListView items with ImageList. Issue #27816, patch from Zeljko + Janusz Tomczak. git-svn-id: trunk@51062 - --- lcl/interfaces/win32/win32wscustomlistview.inc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lcl/interfaces/win32/win32wscustomlistview.inc b/lcl/interfaces/win32/win32wscustomlistview.inc index 3e0e7da2bf..e583ee52e2 100644 --- a/lcl/interfaces/win32/win32wscustomlistview.inc +++ b/lcl/interfaces/win32/win32wscustomlistview.inc @@ -679,7 +679,14 @@ begin _gnu_lvi.iSubItem := ASubIndex; _gnu_lvi.pszText := PChar(PWideChar(UTF8ToUTF16(AText))); - SendMessage(ALV.Handle, LVM_SETITEMTEXTW, WPARAM(AIndex), LPARAM(@_gnu_lvi)); + if (TListView(ALV).ViewStyle in [vsList, vsReport]) and Assigned(TListView(ALV).SmallImages) then + begin + _gnu_lvi.Mask := LVIF_TEXT or LVIF_IMAGE; + _gnu_lvi.iItem := AIndex; + _gnu_lvi.iImage := AItem.ImageIndex; + SendMessage(ALV.Handle, LVM_SETITEMW{TEXTW}, WPARAM(AIndex), LPARAM(@_gnu_lvi)); + end else + SendMessage(ALV.Handle, LVM_SETITEMTEXTW, WPARAM(AIndex), LPARAM(@_gnu_lvi)); // autosize is an *extreme* performance bottleneck, even if WM_SETREDRAW // was set to false it will ignore this and still redraw all columns. // We will therefore postpone all autosizing until EndUpdate where we do