Click to See Complete Forum and Search --> : ListView and subitem image
nixau
September 21st, 2005, 11:18 AM
Hello. It's possible to insert image only for subitem in ListView (no MFC)?
Let say we have three columns A | B | C and we want to insert image ONLY to item in column B.
I add LVS_EX_SUBITEMIMAGES to ListView style column and LVIF_IMAGE style for rows item and it's not work like i want to - now i have image in items in columns A and B. I also try to set lvItem.iImage to 0 and -1 for item in column A but isn't work (only work for column B, C ... but not for A).
kirants
September 21st, 2005, 07:58 PM
confused:
At one time you say
want to insert image ONLY to item in column B
and then you say, only work for column B, C ... but not for A
nixau
September 22nd, 2005, 04:51 AM
Let me explain this. If we have column A | B | C default image is in item in column A (subitem=0). If we add another image to column B (subitem=1) we have now image in column A and B. So we can add image to all listview subitem.
The problem is how to remove image from first column A (subitem=0) leave other image in column B, C, etc. ?
kkez
November 5th, 2005, 09:47 AM
Same problem here. Looks like the solution is customdraw or ownerdraw, or set another icon to the first element (a white image would do the trick)
EDIT:
li.mask = ... LVIF_IMAGE ... ;
li.iImage = -1;
Unfortunately there will be still an indentation for an image even if it doesn't exist.
Synetech
September 23rd, 2008, 02:49 AM
So was this ever solved? I’m trying to put an image in column 1, but not column 0. Using CListCtrl::SetImageList automatically puts an image in column 0, and using I_IMAGENONE leaves an icon-width’d space next to the label.
Marc G
September 24th, 2008, 09:10 AM
Did you try to look into the LVS_EX_SUBITEMIMAGES (http://msdn.microsoft.com/en-us/library/bb774732(VS.85).aspx) style?
Synetech
October 1st, 2008, 11:38 PM
Yes.
I have images in subitems, that’s not the problem. The problem is that by enabling images in a listctrl at all, images are added to the first column (column 0), and even when you set it to no image (eg I_IMAGENONE), an icon is still added to the column 0, but it is blank.
We are trying to find a way to have images in subitems, but NOT in the first column, and no blank “spacer” in it either.
vinhie47
October 6th, 2008, 12:48 AM
Have you tried the way kkez mentioned? Using "lvi.nImage = -1" for the first subitem (subitem 0) could help :)
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.