Type | Description | |||
Index as Long | A long expression that specifies the index of item. | |||
ColIndex as Variant | A long expression that specifies the index of column, a string expression that identifies the column's caption or 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 List1.Items .CellImages(.ItemByIndex(0), 1) = "1,3" End With
The following VB sample displays the index of icon being clicked:
Private Sub List1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) Dim i As Long, h As HitTestInfoEnum, c As Long With List1 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_list.GetItems(); items.SetCellImages( items.GetFocusItem(), COleVariant( (long)0 ), COleVariant( "1,3" ) );
The following C++ sample displays the index of icon being clicked:
#include "Items.h" void OnMouseUpList1(short Button, short Shift, long X, long Y) { CItems items = m_list.GetItems(); long c = 0, hit = 0, h = m_list.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 AxList1.Items .CellImages(.FocusItem, 0) = "1,3" End With
The following VB.NET sample displays the index of icon being clicked:
Private Sub AxList1_MouseUpEvent(ByVal sender As Object, ByVal e As AxEXLISTLib._IListEvents_MouseUpEvent) Handles AxList1.MouseUpEvent With AxList1 Dim i As Integer, c As Integer, hit As EXLISTLib.HitTestInfoEnum i = .get_ItemFromPoint(e.x, e.y, c, hit) If (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:
axList1.Items.set_CellImages(axList1.Items.FocusItem, 0, "1,3");
The following C# sample displays the index of icon being clicked:
private void axList1_MouseUpEvent(object sender, AxEXLISTLib._IListEvents_MouseUpEvent e) { int c = 0; EXLISTLib.HitTestInfoEnum hit; int i = axList1.get_ItemFromPoint(e.x, e.y, out c, out hit); if ((i >= 0)) { if ((Convert.ToUInt32(hit) & Convert.ToUInt32(EXLISTLib.HitTestInfoEnum.exHTCellIcon)) == Convert.ToUInt32(EXLISTLib.HitTestInfoEnum.exHTCellIcon)) { string s = axList1.Items.get_Caption(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.List1.Items .CellImages(.FocusItem,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, i c = 0 hit = 0 with thisform.List1 i = .ItemFromPoint( x, y, @c, @hit ) if ( i >= 0 ) if ( bitand( hit, 68 )= 68 ) wait window nowait .Items.Caption( i, c ) + " " + Str( Int((hit - 68)/65536) ) endif endif endwith
Add the code to the MouseUp, MouseMove or MouseDown event