CTreeCtrl item images without CImageList ?
-
Main Question: Is it possible to set a tree item image (CTreeCtrl::SetItemImage) without having to build a CImageList ? I have to build different images corresponding to the items state and I would like to be able to create the image dynamically (lot of TransparentBlt) instead of having to list and build all the images and add them statically to the image list. i have a default item image and I TransparentBlt state images on it for example, an item can have the state1 enabled, and will display the appropriate image representing state1. an another item can have state1 and state4 and will display an image with the state1 and state4 Now, I have to create the imagelist for all combinations of states at compile time and call the SetItemImage with the image list index. I'd like to be able to simply call something like:
myTree.SetItemImage( hItem, BuildMyItemImage(hItem ) ); // and that would dynamically build an image depending on the states and just use it.
I'd rather be phishing!
-
Main Question: Is it possible to set a tree item image (CTreeCtrl::SetItemImage) without having to build a CImageList ? I have to build different images corresponding to the items state and I would like to be able to create the image dynamically (lot of TransparentBlt) instead of having to list and build all the images and add them statically to the image list. i have a default item image and I TransparentBlt state images on it for example, an item can have the state1 enabled, and will display the appropriate image representing state1. an another item can have state1 and state4 and will display an image with the state1 and state4 Now, I have to create the imagelist for all combinations of states at compile time and call the SetItemImage with the image list index. I'd like to be able to simply call something like:
myTree.SetItemImage( hItem, BuildMyItemImage(hItem ) ); // and that would dynamically build an image depending on the states and just use it.
I'd rather be phishing!
-
Not according to CTreeCtrl Class | Microsoft Docs[^]. You could try adding your new image to the CImageList and using the new index value.
that's what I am doing; just annoying to have to create images for many combinations. Thanks.
I'd rather be phishing!