Retrieves or sets an Image that is displayed on the cell's area.
Type | Description | |||
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. |
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 FilterType property on exImage to filter items by icons. 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.
The following sample sets cell's image for the first column ( to run the sample make sure that control's images collection is not empty):
Private Sub ExplorerTree1_AddItem(ByVal Group As EXPLORERTREELibCtl.IGroup, ByVal Item As EXPLORERTREELibCtl.HITEM) With Group.Items .CellImage(Item, 0) = 1 End With End Sub
The following 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 ExplorerTree1_AddItem(ByVal Group As EXPLORERTREELibCtl.IGroup, ByVal Item As EXPLORERTREELibCtl.HITEM) With Group.Items .CellImage(Item, 0) = 1 End With End Sub Private Sub ExplorerTree1_CellImageClick(ByVal Group As EXPLORERTREELibCtl.IGroup, ByVal Item As EXPLORERTREELibCtl.HITEM, ByVal ColIndex As Long) With Group.Items .CellImage(Item, ColIndex) = .CellImage(Item, ColIndex) Mod 2 + 1 End With End Sub
Note: A cell is the intersection of an item with a column. All properties that has an Item and a ColIndex parameters are referring to a cell. The Item parameter represents the handle of an item, and the ColIndex parameter indicates an index ( a numerical value, see Column.Index property ) of a column , the column's caption ( a string value, see Column.Caption property ), or a handle to a cell. Here's few hints how to use properties with Item and ColIndex parameters:
Group.Items.CellBold(, Group.Items.ItemCell(Group.Items(0), 0)) = True Group.Items.CellBold(Group.Items(0), 0) = True Group.Items.CellBold(Group.Items(0), "ColumnName") = True