TTreeView.Images, how to use

Posted on 2004-11-17
Last Modified: 2010-04-16
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?
Question by:__alex
    LVL 17

    Accepted Solution


    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
    LVL 2

    Author Comment

    Exactly what I do. I will post some code in a few minutes...
    LVL 2

    Author Comment

    Ooops! I forgot to set the Width and Height property of the image list.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    Suggested Solutions

    This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
    Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now