

| 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. | |||
| Variant | A string expression that indicates the list of icons shown in the cell. |
The following VB sample assigns the first and third icon to the cell:
With Gantt1.Items
.CellImages(.ItemByIndex(0), 1) = "1,3"
End With
The following VB sample displays the index of icon being clicked:
Private Sub Gantt1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim i As HITEM, h As HitTestInfoEnum, c As Long
With Gantt1
i = .ItemFromPoint(X / Screen.TwipsPerPixelX, Y / Screen.TwipsPerPixelY, c, h)
End With
If (i <> 0) Then
If exHTCellIcon = (h And exHTCellIcon) Then
Debug.Print "The index of icon being clicked is: " & (h And &HFFFF0000) / 65536
End If
End If
End Sub
The following C++ sample assigns the first and the third icon to the cell:
#include "Items.h" CItems items = m_gantt.GetItems(); items.SetCellImages( COleVariant( items.GetFocusItem() ), COleVariant( (long)0 ), COleVariant( "1,3" ) );
The following C++ sample displays the index of icon being clicked:
#include "Items.h"
void OnMouseUpGantt1(short Button, short Shift, long X, long Y)
{
CItems items = m_gantt.GetItems();
long c = 0, hit = 0, h = m_gantt.GetItemFromPoint( X, Y, &c, &hit);
if ( h != 0 )
{
if ( ( hit & 0x44 /*exHTCellIcon*/ ) == 0x44 )
{
CString strFormat;
strFormat.Format( "The index of icon being clicked is: %i\n", (hit >> 16) );
OutputDebugString( strFormat );
}
}
}
The following VB.NET sample assigns the first and the third icon to the cell:
With AxGantt1.Items
.CellImages(.FocusItem, 0) = "1,3"
End With
The following VB.NET sample displays the index of icon being clicked:
Private Sub AxGantt1_MouseUpEvent(ByVal sender As Object, ByVal e As AxEXGANTTLib._IGanttEvents_MouseUpEvent) Handles AxGantt1.MouseUpEvent
With AxGantt1
Dim i As Integer, c As Integer, hit As EXGANTTLib.HitTestInfoEnum
i = .get_ItemFromPoint(e.x, e.y, c, hit)
If (Not (i = 0)) Then
Debug.WriteLine("The index of icon being clicked is: " & (hit And &HFFFF0000) / 65536)
End If
End With
End Sub
The following C# sample assigns the first and the third icon to the cell:
axGantt1.Items.set_CellImages(axGantt1.Items.FocusItem, 0, "1,3");
The following C# sample displays the index of icon being clicked:
private void axGantt1_MouseUpEvent(object sender, AxEXGANTTLib._IGanttEvents_MouseUpEvent e)
{
int c = 0;
EXGANTTLib.HitTestInfoEnum hit;
int i = axGantt1.get_ItemFromPoint(e.x, e.y, out c, out hit);
if ((i != 0))
{
if ((Convert.ToUInt32(hit) & Convert.ToUInt32(EXGANTTLib.HitTestInfoEnum.exHTCellIcon)) == Convert.ToUInt32(EXGANTTLib.HitTestInfoEnum.exHTCellIcon))
{
string s = axGantt1.Items.get_CellCaption(i, c).ToString();
s = "Cell: " + s + ", Icon's Index: " + (Convert.ToUInt32(hit) >> 16).ToString();
System.Diagnostics.Debug.WriteLine(s);
}
}
}
The following VFP sample assigns the first and the third icon to the cell:
with thisform.Gantt1.Items .DefaultItem = .FocusItem .CellImages(0,0) = "1,3" endwith
The following VFP sample displays the index of icon being clicked:
*** ActiveX Control Event *** LPARAMETERS button, shift, x, y local c, hit c = 0 hit = 0 with thisform.Gantt1 .Items.DefaultItem = .ItemFromPoint( x, y, @c, @hit ) if ( .Items.DefaultItem <> 0 ) if ( bitand( hit, 68 )= 68 ) wait window nowait .Items.CellCaption( 0, c ) + " " + Str( Int((hit - 68)/65536) ) endif endif endwith
Add the code to the MouseUp, MouseMove or MouseDown event,