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. 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 CellValueFormat property is exHTML. Use the FilterType property on exImage to filter items by icons. Use the Def(exCellDrawPartsOrder) property to change the positions of drawing elements in the cell.
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 G2antt1_AddItem(ByVal Item As EXG2ANTTLibCtl.HITEM) G2antt1.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 g2antt's images collection. ),
Private Sub G2antt1_AddItem(ByVal Item As EXG2ANTTLibCtl.HITEM) G2antt1.Items.CellImage(Item, 0) = 1 End Sub Private Sub G2antt1_CellImageClick(ByVal Item As EXG2ANTTLibCtl.HITEM, ByVal ColIndex As Long) G2antt1.Items.CellImage(Item, ColIndex) = G2antt1.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_g2antt.GetItems(); items.SetCellImage( COleVariant( items.GetFocusItem() ), COleVariant( (long)0 ), 1 );
The following C# sample displays the first icon in the focused cell:
axG2antt1.Items.set_CellImage(axG2antt1.Items.FocusItem, 0, 1);
The following VB.NET sample displays the first icon in the focused cell:
With AxG2antt1.Items .CellImage(.FocusItem, 0) = 1 End With
The following VFP sample displays the first icon in the focused cell:
with thisform.G2antt1.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:
G2antt1.Items.CellBold(, G2antt1.Items.ItemCell(G2antt1.Items(0), 0)) = True
G2antt1.Items.CellBold(G2antt1.Items(0), 0) = True
G2antt1.Items.CellBold(G2antt1.Items(0), "ColumnName") = True