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 Column.Def(exCellDrawPartsOrder) property specifies the order of the drawing parts for the entire column. By default, the parts are shows as check icon icons picture caption.

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 Gantt1_AddItem(ByVal Item As EXGANTTLibCtl.HITEM)
    Gantt1.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 gantt's images collection. ),

Private Sub Gantt1_AddItem(ByVal Item As EXGANTTLibCtl.HITEM)
    Gantt1.Items.CellImage(Item, 0) = 1
End Sub

Private Sub Gantt1_CellImageClick(ByVal Item As EXGANTTLibCtl.HITEM, ByVal ColIndex As Long)
    Gantt1.Items.CellImage(Item, ColIndex) = Gantt1.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_gantt.GetItems();
items.SetCellImage( COleVariant( items.GetFocusItem() ), COleVariant( (long)0 ), 1 );

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

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

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

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

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

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

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:

Gantt1.Items.CellBold(, Gantt1.Items.ItemCell(Gantt1.Items(0), 0)) = True
Gantt1.Items.CellBold(Gantt1.Items(0), 0) = True
Gantt1.Items.CellBold(Gantt1.Items(0), "ColumnName") = True

Send comments on this topic.
1999-2017 Exontrol.COM, Software. All rights reserved.