images in different columns in a listctrl
-
hi, I want the list control to be able to have images in differnt columns( could be any column 0,1,2..) so i create a CIMAGELIST from some resource and also set it for the list control by calling the method m_listCtrl->SetImageList(&m_imagelistsmall, LVSIL_SMALL); What this does is set the images from the imagelist in column1( always). even when i dont specify the LVIF_IMAGE mask when adding item. I dont want the image in the first column. Also what do i do to have the image in other other columns
-
hi, I want the list control to be able to have images in differnt columns( could be any column 0,1,2..) so i create a CIMAGELIST from some resource and also set it for the list control by calling the method m_listCtrl->SetImageList(&m_imagelistsmall, LVSIL_SMALL); What this does is set the images from the imagelist in column1( always). even when i dont specify the LVIF_IMAGE mask when adding item. I dont want the image in the first column. Also what do i do to have the image in other other columns
You can't do this with a Windows list control - it can only display icons in the first (left-most) column. You'll need a custom control to do what you want. A grid control that lets you put images in any cell might be the thing. Take a look at this control[^], here on CP. The chap who developed it is also a dab hand at web sites...
-
You can't do this with a Windows list control - it can only display icons in the first (left-most) column. You'll need a custom control to do what you want. A grid control that lets you put images in any cell might be the thing. Take a look at this control[^], here on CP. The chap who developed it is also a dab hand at web sites...
Thanks. I made some of it possible and here is how i achieved it. I have an extended class of list ctrl. when i set the imagelist for the list it shows in the left most column by default so what i do is i do set the image in LVITEM but specify it to be some thing outside the range in the bitmap say 2000. This prevents the images to be shown in the left most column. Also for showing the image in some other column i use the LVS_EX_SUBITEMIMAGES extended style.
-
hi, I want the list control to be able to have images in differnt columns( could be any column 0,1,2..) so i create a CIMAGELIST from some resource and also set it for the list control by calling the method m_listCtrl->SetImageList(&m_imagelistsmall, LVSIL_SMALL); What this does is set the images from the imagelist in column1( always). even when i dont specify the LVIF_IMAGE mask when adding item. I dont want the image in the first column. Also what do i do to have the image in other other columns
That's how the control works - you always get an image in column 0 when you set an image list. To put images in other columns, set the
LVS_EX_SUBITEMIMAGES
extended style. Then when you insert new items, the control will look at theiImage
field in theLVITEM
and show the corresponding image. --Mike-- Personal stuff:: Ericahist | Homepage Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ ----