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

Retrieves or sets a value that indicates the index of icon to display in the cell..

TypeDescription
Item as Variant A long expression that indicates the item's handle.
ColIndex as Variant A long expression that indicates the cell's handle or 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 index of the icon in Images collection. The Images collection is 1 based. 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.

The CellImage property assigns a single icon to a cell. Use the CellImage() = 0 to remove the cell's icon, that was previous assigned using the CellImage property . Use the CellImages property to assign multiple icons to a single cell. The CellImageClick event occurs when the user clicks the cell's icon. The icon's size is always 16 x 16. Use the CellPicture property to load a a picture of different size. Use the Images or ReplaceIcon method to load icons to the control. 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 FilterType property on exImage to filter items by icons. Use the <img> HTML tag to insert icons inside the cell's caption. Use the Def( exCellDrawPartsOrder) property to specify the order of the drawing parts inside the cell. The ImageSize property defines the size (width/height) of the icons within the control's Images collection.

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

With Grid1.Items
    .CellImage(.FocusItem, Grid1.FocusColumnIndex) = 1
End With

The following VB sample changes the cell's icon for all icons in the first column, as soon as new items are inserted to the control:

Private Sub Grid1_AddItem(ByVal Item As EXGRIDLibCtl.HITEM)
    Grid1.Items.CellImage(Item, 0) = 1
End Sub

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

Private Sub Grid1_AddItem(ByVal Item As EXGRIDLibCtl.HITEM)
    Grid1.Items.CellImage(Item, 0) = 1
End Sub

Private Sub Grid1_CellImageClick(ByVal Item As EXGRIDLibCtl.HITEM, ByVal ColIndex As Long)
    Grid1.Items.CellImage(Item, ColIndex) = Grid1.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_grid.GetItems();
items.SetCellImage( COleVariant( items.GetFocusItem() ), COleVariant( (long)m_grid.GetFocusColumnIndex() ), 1 );

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

axGrid1.Items.set_CellImage(axGrid1.Items.FocusItem, axGrid1.FocusColumnIndex, 1);

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

With AxGrid1.Items
    .CellImage(.FocusItem, AxGrid1.FocusColumnIndex) = 1
End With

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

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

Note: The intersection of an item with a column defines a cell. Each cell is uniquely represented by its handle. The cell's handle is of HCELL type, that's equivalent with a long type. All properties of Items object that have two parameters Item and ColIndex, refer a cell.

The following lines are equivalents and each of them changes the bold font attribute of the first cell on the first item.

With Grid1
    .Items.CellBold(, .Items.ItemCell(.Items(0), 0)) = True
    .Items.CellBold(.Items(0), 0) = True
    .Items.CellBold(.Items(0)) = True
    .Items.CellBold(.Items.ItemByIndex(0)) = True
    .Items.CellBold(.Items.ItemByIndex(0), 0) = True
    .Items.CellBold(.Items(0), Grid1.Columns(0).Caption) = True
End With