Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 208
  • Last Modified:

TTreeView.Images, how to use

I added two bitmaps to the Images property of a TreeView. However, it appears that only even values of TTreeNode.ImageIndex / SelectedIndex make sense. What are the odd values good for. Maybe I'm completely wrong and it works just by coincidence?
0
__alex
Asked:
__alex
  • 2
1 Solution
 
geobulCommented:
Hi,

Set ImageIndex property of every tree node to a image from the ImageList (zero based, i.e 0 for the first image, etc.). This image will apear when the node is not selected.

Set SelectedIndex property of every tree node to the same value as ImageIndex if you want to keep that image when any node becomes selected.

You may want one image for the selected node (i.e. a node has one image when it's not selected and another when it is selected). Usually the first image in the list (index 0) is that image and you don't have to explicitly set SelectedIndex in that case.

Regards, Geo
0
 
__alexAuthor Commented:
Exactly what I do. I will post some code in a few minutes...
0
 
__alexAuthor Commented:
Ooops! I forgot to set the Width and Height property of the image list.
0

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now