Tree-View Image Lists

Each item in a tree-view control can have a pair of bitmapped images associated with it. The images appear on the left side of an item's label. One image is displayed when the item is selected, and the other is displayed when the item is not selected. For example, an item might display an open folder when it is selected and a closed folder when it is not selected.

To use item images, you must create an image list by using the ImageList_Create function, add the desired bitmaps to the list, and associate the list with the tree-view control by using the TVM_SETIMAGELIST message. By default, all items display the first image in the image list for both the selected and nonselected states. You can change the default behavior for a particular item by specifying the indexes of the selected and nonselected images when adding the item to the tree view using the TVM_INSERTITEM message. You can change the indexes after adding an item by using the TVM_SETITEM message.

A tree-view control's image lists can also contain overlay images, which are designed to be superimposed on item images. A nonzero value in bits 8 through 11 of a tree-view item's state specifies the one-based index of an overlay image (zero indicates no overlay image). Because a 4-bit, one-based index is used, overlay images must be among the first 15 images in the image lists. For more information about tree-view item states, see Tree-View Item States Overview.

If a state image list is specified, a tree-view control reserves space to the left of each item's icon for a state image. An application can use state images, such as checked and cleared check boxes, to indicate application-defined item states. A nonzero value in bits 12 through 15 specifies the one-based index of a state image (zero indicates no state image).

By specifying the I_IMAGECALLBACK value instead of the index of an image in the TV_ITEM structure, you can put off specifying the selected or nonselected image until the item is about to be redrawn. I_IMAGECALLBACK directs the tree view to query the parent window for the index by sending the TVN_GETDISPINFO notification message.

The TVM_GETIMAGELIST message retrieves the handle of a tree-view control's image list. This message is useful if you need to add more images to the list. For more information about image lists, see Image Lists.

Software for developers
Delphi Components
.Net Components
Software for Android Developers
More information resources
MegaDetailed.Net
Unix Manual Pages
Delphi Examples
Databases for Amazon shops developers
Amazon Categories Database
Browse Nodes Database