Discussion:
Setting and removing imagelist in CListCtrl
(too old to reply)
Dale Fugier
2005-07-15 23:23:28 UTC
Permalink
I am trying to figure out how to set, replace and remove an imagelist for a
CListCtrl at runtime.

If, during the creation of the CListCtrl, I set an imagelist, using
SetImageList(), I am able to remove it using RemoveImageList(). But, the
list control appears to still leave some space between the edge of the
control and text items for an image of some kind (in report mode). Also,
after removing the image, I am not able to re-set it.

If I do not set an imagelist when creating the control, the text items
appear next to the left edge of the control (in report mode). But, I am not
able to set one after the fact.

Any help would really be appreciated.

Thanks in advance,

-Dale
Scot T Brennecke
2005-07-16 00:36:27 UTC
Permalink
If I'm correct, it's the status of the iImage member when you create an item that determines whether
or not to indent for an image. If it's -1 or less, it doesn't indent, if greater than -1, and the
list control has an image list, it does indent. Even if you remove the image list, if the image
index is still non-negative, I believe it reserves space for it.
I am trying to figure out how to set, replace and remove an imagelist for a CListCtrl at runtime.
If, during the creation of the CListCtrl, I set an imagelist, using SetImageList(), I am able to
remove it using RemoveImageList(). But, the list control appears to still leave some space between
the edge of the control and text items for an image of some kind (in report mode). Also, after
removing the image, I am not able to re-set it.
If I do not set an imagelist when creating the control, the text items appear next to the left
edge of the control (in report mode). But, I am not able to set one after the fact.
Any help would really be appreciated.
Dale Fugier
2005-07-18 16:19:09 UTC
Permalink
Hi Scot, thanks for replying.

I tried your suggestion, but I still get the space for the image left even
when I set the image indices to -1.

I am just trying to allow the user the option of either displaying an items
image or not without owner drawing the control.

I might be out of luck.

Thanks again,

-Dale
Post by Scot T Brennecke
If I'm correct, it's the status of the iImage member when you create an
item that determines whether or not to indent for an image. If it's -1 or
less, it doesn't indent, if greater than -1, and the list control has an
image list, it does indent. Even if you remove the image list, if the
image index is still non-negative, I believe it reserves space for it.
Post by Dale Fugier
I am trying to figure out how to set, replace and remove an imagelist for
a CListCtrl at runtime.
If, during the creation of the CListCtrl, I set an imagelist, using
SetImageList(), I am able to remove it using RemoveImageList(). But, the
list control appears to still leave some space between the edge of the
control and text items for an image of some kind (in report mode). Also,
after removing the image, I am not able to re-set it.
If I do not set an imagelist when creating the control, the text items
appear next to the left edge of the control (in report mode). But, I am
not able to set one after the fact.
Any help would really be appreciated.
Loading...