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 G2antt1.Items .CellImages(.ItemByIndex(0), 1) = "1,3" End With
The following VB sample displays the index of icon being clicked:
Private Sub G2antt1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) Dim i As HITEM, h As HitTestInfoEnum, c As Long With G2antt1 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_g2antt.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 OnMouseUpG2antt1(short Button, short Shift, long X, long Y) { CItems items = m_g2antt.GetItems(); long c = 0, hit = 0, h = m_g2antt.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 AxG2antt1.Items .CellImages(.FocusItem, 0) = "1,3" End With
The following VB.NET sample displays the index of icon being clicked:
Private Sub AxG2antt1_MouseUpEvent(ByVal sender As Object, ByVal e As AxEXG2ANTTLib._IG2anttEvents_MouseUpEvent) Handles AxG2antt1.MouseUpEvent With AxG2antt1 Dim i As Integer, c As Integer, hit As EXG2ANTTLib.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:
axG2antt1.Items.set_CellImages(axG2antt1.Items.FocusItem, 0, "1,3");
The following C# sample displays the index of icon being clicked:
private void axG2antt1_MouseUpEvent(object sender, AxEXG2ANTTLib._IG2anttEvents_MouseUpEvent e) { int c = 0; EXG2ANTTLib.HitTestInfoEnum hit; int i = axG2antt1.get_ItemFromPoint(e.x, e.y, out c, out hit); if ((i != 0)) { if ((Convert.ToUInt32(hit) & Convert.ToUInt32(EXG2ANTTLib.HitTestInfoEnum.exHTCellIcon)) == Convert.ToUInt32(EXG2ANTTLib.HitTestInfoEnum.exHTCellIcon)) { string s = axG2antt1.Items.get_CellValue(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.G2antt1.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.G2antt1 .Items.DefaultItem = .ItemFromPoint( x, y, @c, @hit ) if ( .Items.DefaultItem <> 0 ) if ( bitand( hit, 68 )= 68 ) wait window nowait .Items.CellValue( 0, c ) + " " + Str( Int((hit - 68)/65536) ) endif endif endwith
Add the code to the MouseUp, MouseMove or MouseDown event,