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. For instance, the "1,2,3" indicates that the icons 1, 2, 3 are displayed in the cell. |
The following VB sample assign the first and third icon to the cell:
With Grid1.Items .CellImages(.ItemByIndex(0), 1) = "1,3" End With
The following VB sample displays the index of icon being clicked, when the cell contains multiple icons ( MouseUp event ):
Private Sub Grid1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) Dim i As HITEM, h As HitTestInfoEnum, c As Long With Grid1 i = .ItemFromPoint(-1, -1, c, h) End With If (i <> 0) Then If exHTCellIcon = (h And exHTCellIcon) Then Debug.Print "The index of icon being clicked is: " & CLng((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_grid.GetItems(); items.SetCellImages( COleVariant( items.GetFocusItem() ), COleVariant( (long)m_grid.GetFocusColumnIndex() ), COleVariant( "1,3" ) );
The following C++ sample displays the index of icon being clicked:
#include "Items.h" void OnMouseUpGrid1(short Button, short Shift, long X, long Y) { CItems items = m_grid.GetItems(); long c = 0, hit = 0, h = m_grid.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 AxGrid1.Items .CellImages(.FocusItem, AxGrid1.FocusColumnIndex) = "1,3" End With
The following VB.NET sample displays the index of icon being clicked:
Private Sub AxGrid1_MouseUpEvent(ByVal sender As Object, ByVal e As AxEXGRIDLib._IGridEvents_MouseUpEvent) Handles AxGrid1.MouseUpEvent With AxGrid1 Dim i As Integer, c As Integer, hit As EXGRIDLib.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:
axGrid1.Items.set_CellImages(axGrid1.Items.FocusItem, axGrid1.FocusColumnIndex, "1,3");
The following C# sample displays the index of icon being clicked:
private void axGrid1_MouseUpEvent(object sender, AxEXGRIDLib._IGridEvents_MouseUpEvent e) { int c = 0; EXGRIDLib.HitTestInfoEnum hit; int i = axGrid1.get_ItemFromPoint(e.x, e.y, out c, out hit); if ((i != 0)) { if ((Convert.ToUInt32(hit) & Convert.ToUInt32(EXGRIDLib.HitTestInfoEnum.exHTCellIcon)) == Convert.ToUInt32(EXGRIDLib.HitTestInfoEnum.exHTCellIcon)) { string s = axGrid1.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.Grid1.Items .DefaultItem = .FocusItem .CellImages(0,thisform.Grid1.FocusColumnIndex) = "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.Grid1 .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