Images in every column of listcontrol
-
I used the following code to show an image in the row of a listcontrol.
LV_ITEM lvi;
CString item,symbol;
symbol = card.Right(1);
int len = card.GetLength();
item = card.Left(len-1);lvi.mask = LVIF\_IMAGE | LVIF\_TEXT ; lvi.iItem = 0; lvi.iSubItem = isubItem; lvi.pszText = item.GetBuffer(item.GetLength()); lvi.stateMask = LVIS\_STATEIMAGEMASK|LVM\_SETITEMSTATE; if(symbol.CompareNoCase("C")==0) lvi.iImage = 0; else if (symbol.CompareNoCase("D")==0) lvi.iImage = 1; else if(symbol.CompareNoCase("H")==0) lvi.iImage = 2; else if (symbol.CompareNoCase("S")==0) lvi.iImage = 3; player1.SetItem(&lvi);
There are 13 columns in the row. and there is only one row. I wanted the image to be shown in every column of that row. But the image is being shown only in the first column. How to make it. Thank you
Saadhinchaali
-
I used the following code to show an image in the row of a listcontrol.
LV_ITEM lvi;
CString item,symbol;
symbol = card.Right(1);
int len = card.GetLength();
item = card.Left(len-1);lvi.mask = LVIF\_IMAGE | LVIF\_TEXT ; lvi.iItem = 0; lvi.iSubItem = isubItem; lvi.pszText = item.GetBuffer(item.GetLength()); lvi.stateMask = LVIS\_STATEIMAGEMASK|LVM\_SETITEMSTATE; if(symbol.CompareNoCase("C")==0) lvi.iImage = 0; else if (symbol.CompareNoCase("D")==0) lvi.iImage = 1; else if(symbol.CompareNoCase("H")==0) lvi.iImage = 2; else if (symbol.CompareNoCase("S")==0) lvi.iImage = 3; player1.SetItem(&lvi);
There are 13 columns in the row. and there is only one row. I wanted the image to be shown in every column of that row. But the image is being shown only in the first column. How to make it. Thank you
Saadhinchaali
Saadhinchaali wrote:
How to make it.
You have to set LVS_EX_SUBITEMIMAGES style inorder to display images in subitem.
player1.SetExtendedStyle( player1.GetExtendedStyle()|LVS_EX_SUBITEMIMAGES );
nave [OpenedFileFinder]