property Items.CellImage ([Item as Variant], [ColIndex as Variant]) as Long

Retrieves or sets an Image that is displayed on the cell's area.

TypeDescription
Item as Variant A long expression that indicates the item's handle.
ColIndex as Variant A long expression that indicates the column's index, a string expression that indicates the column's caption or the column's key.
Long A long value that indicates the image index. The last 7 bits in the high significant byte of the long expression indicates the identifier of the skin being used to paint the object. Use the Add method to add new skins to the control. If you need to remove the skin appearance from a part of the control you need to reset the last 7 bits in the high significant byte of the color being applied to the part.

Use the CellImage property to assign a single icon to a cell. Use the CellImages property to assign multiple icons to a cell.  Use the Images method to assign icons to the control at runtime. You can add images at design time by dragging a file to image editor of the control. The CellImage = 0 removes the cell's image. The collection of Images is 1 based. The CellImageClick event occurs when the cell's image is clicked. Use the ItemFromPoint property to retrieve the part of the control being clicked. Use the CellHasCheckBox property to add a check box to a cell. Use the CellHasRadioButton property to assign a radio button to a cell. Use the CellPicture property to load a custom size picture to a cell. Use the <img> HTML tag to insert icons inside the cell's caption, if the CellCaptionFormat property is exHTML. Use the FilterType property on exImage to filter items by icons. The ImageSize property defines the size (width/height) of the icons within the control's Images collection.

The following VB sample sets cell's image for the first column while new items are added ( to run the sample make sure that control's images collection is not empty):

Private Sub Tree1_AddItem(ByVal Item As EXTREELibCtl.HITEM)
    Tree1.Items.CellImage(Item, 0) = 1
End Sub

The following VB sample changes the cell's image when the user has clicked on the cell's image ( to run the following sample you have to add two images to the tree's images collection. ),

Private Sub Tree1_AddItem(ByVal Item As EXTREELibCtl.HITEM)
    Tree1.Items.CellImage(Item, 0) = 1
End Sub

Private Sub Tree1_CellImageClick(ByVal Item As EXTREELibCtl.HITEM, ByVal ColIndex As Long)
    Tree1.Items.CellImage(Item, ColIndex) = Tree1.Items.CellImage(Item, ColIndex) Mod 2 + 1
End Sub

The following C++ sample displays the first icon in the focused cell:

#include "Items.h"
CItems items = m_tree.GetItems();
items.SetCellImage( COleVariant( items.GetFocusItem() ), COleVariant( (long)0 ), 1 );

The following C# sample displays the first icon in the focused cell:

axTree1.Items.set_CellImage(axTree1.Items.FocusItem, 0, 1);

The following VB.NET sample displays the first icon in the focused cell:

With AxTree1.Items
    .CellImage(.FocusItem, 0) = 1
End With

The following VFP sample displays the first icon in the focused cell:

with thisform.Tree1.Items
	.DefaultItem = .FocusItem
	.CellImage(0,0) = 1
endwith

Note: A cell is identified by the intersection of an item and a column. Properties that have Item and ColIndex parameters let you specify a cell in different ways. The Item parameter identifies the item, while the ColIndex parameter identifies the column.

The Item parameter can be the handle of an item. The ColIndex parameter can specify the column by its index (a numerical value, see the Column.Index property), by its caption (a string value, see the Column.Caption property), or by a cell handle returned by the ItemCell property.

For example, the following statement sets the Bold property of the cell at the intersection of the first item and the first column. The Item parameter is omitted because the ColIndex parameter receives the cell handle returned by ItemCell.

Tree1.Items.CellBold(, Tree1.Items.ItemCell(Tree1.Items(0), 0)) = True

The same cell can be specified by passing the item handle and the column index separately:

Tree1.Items.CellBold(Tree1.Items(0), 0) = True

You can also specify the column by its caption instead of its numerical index:

Tree1.Items.CellBold(Tree1.Items(0), "ColumnName") = True