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.

Use the CellImage property to assign a single icon to the cell. The ImageSize property defines the size (width/height) of the icons within the control's Images collection. Use the CellImages property to assign multiple icons to a cell. Use the Images method or ReplaceIcon property to update the list of icons in the control, at runtime. Use the CellImage() = 0 to remove an cell's icon. The CellImageClick event occurs when the cell's icon is clicked. The icon's size is always 16 x 16. Use the CellPicture property to assign a custom size picture to a cell. 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 ItemFromPoint property to retrieve the part of the control being clicked. Use the AssignEditImageOnSelect property to display the cell's icon on the control's label when user selects a new item. 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 following VB sample assigns the same icon to all cells in the first column:

Private Sub ComboBox1_InsertItem(ByVal Item As EXCOMBOBOXLibCtl.HITEM)
    With ComboBox1.Items
        .CellImage(Item, 0) = 1
    End With
End Sub

The following VB 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 ComboBox's images collection ),

Private Sub ComboBox1_InsertItem(ByVal Item As EXCOMBOBOXLibCtl.HITEM)
    With ComboBox1.Items
        .CellImage(Item, 0) = 1
    End With
End Sub

Private Sub ComboBox1_CellImageClick(ByVal Cell As EXCOMBOBOXLibCtl.HCELL)
    ComboBox1.Items.CellImage(, Cell) = ComboBox1.Items.CellImage(, Cell) Mod 2 + 1
End Sub

The following C++ sample assigns an icon to the focused cell:

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

The following VB.NET sample assigns an icon to the focused cell:

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

The following C# sample assigns an icon to the focused cell:

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

The following VFP sample assigns an icon to the focused cell:

with thisform.ComboBox1.Items
	.DefaultItem = .FocusItem
	.CellImage(0,0) = 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 ComboBox1
    .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), ComboBox1.Columns(0).Caption) = True
End With