Type | Description | |||
Item as HITEM | A long expression that determines the item's handle. If the Item parameter is 0, and the ColIndex property is different than zero, the ColIndex indicates the handle of the cell where the state is changed. | |||
ColIndex as Long | A long expression that indicates the column's index, if the Item parameter is not zero, a long expression that indicates the handle of the cell if the Item parameter is 0. |
The CellImageClick event notifies your application that an icon in the cell is clicked. Use the CellImage property to assign an icon to a cell. Use the CellImages property to assign multiple icons to a cell. Use the ItemFromPoint property to get the index of icon being clicked, if the cell displays multiple icons using the CellImages property. The CellImageClick event is not fired if you are clicking a custom size picture added with the CellPicture property. Use the CellHasCheckBox or CellHasRadioButton property to assign a check box or a radio button to a cell. Use the CellStateChanged event to notify your application that the the cell's checkbox or radio button is clicked:
Syntax for CellImageClick event, /NET version, on:
private void CellImageClick(object sender,int Item,int ColIndex) { } Private Sub CellImageClick(ByVal sender As System.Object,ByVal Item As Integer,ByVal ColIndex As Integer) Handles CellImageClick End Sub |
private void CellImageClick(object sender, AxEXGRIDLib._IGridEvents_CellImageClickEvent e) { } void OnCellImageClick(long Item,long ColIndex) { } void __fastcall CellImageClick(TObject *Sender,Exgridlib_tlb::HITEM Item,long ColIndex) { } procedure CellImageClick(ASender: TObject; Item : HITEM;ColIndex : Integer); begin end; procedure CellImageClick(sender: System.Object; e: AxEXGRIDLib._IGridEvents_CellImageClickEvent); begin end; begin event CellImageClick(long Item,long ColIndex) end event CellImageClick Private Sub CellImageClick(ByVal sender As System.Object, ByVal e As AxEXGRIDLib._IGridEvents_CellImageClickEvent) Handles CellImageClick End Sub Private Sub CellImageClick(ByVal Item As EXGRIDLibCtl.HITEM,ByVal ColIndex As Long) End Sub Private Sub CellImageClick(ByVal Item As Long,ByVal ColIndex As Long) End Sub LPARAMETERS Item,ColIndex PROCEDURE OnCellImageClick(oGrid,Item,ColIndex) RETURN |
<SCRIPT EVENT="CellImageClick(Item,ColIndex)" LANGUAGE="JScript"> </SCRIPT> <SCRIPT LANGUAGE="VBScript"> Function CellImageClick(Item,ColIndex) End Function </SCRIPT> Procedure OnComCellImageClick HITEM llItem Integer llColIndex Forward Send OnComCellImageClick llItem llColIndex End_Procedure METHOD OCX_CellImageClick(Item,ColIndex) CLASS MainDialog RETURN NIL void onEvent_CellImageClick(int _Item,int _ColIndex) { } function CellImageClick as v (Item as OLE::Exontrol.Grid.1::HITEM,ColIndex as N) end function function nativeObject_CellImageClick(Item,ColIndex) return |
The following VB sample changes the cell's icon when the user clicks the icon:
Private Sub Grid1_CellImageClick(ByVal Item As EXGRIDLibCtl.HITEM, ByVal ColIndex As Long) With Grid1.Items .CellImage(Item, ColIndex) = (.CellImage(Item, ColIndex) Mod 2) + 1 End With End Sub
The following VB sample displays the index of icon being clicked, when the cell displays multiple icons ( CellImages property ):
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(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 changes the cell's icon being clicked:
#include "Items.h" void OnCellImageClickGrid1(long Item, long ColIndex) { CItems items = m_grid.GetItems(); COleVariant vtItem( Item ), vtColumn( ColIndex ); items.SetCellImage( vtItem , vtColumn , items.GetCellImage( vtItem, vtColumn ) % 2 + 1 ); }
The following VB.NET sample changes the cell's icon being clicked:
Private Sub AxGrid1_CellImageClick(ByVal sender As Object, ByVal e As AxEXGRIDLib._IGridEvents_CellImageClickEvent) Handles AxGrid1.CellImageClick With AxGrid1.Items .CellImage(e.item, e.colIndex) = .CellImage(e.item, e.colIndex) Mod 2 + 1 End With End Sub
The following C# sample changes the cell's icon being clicked:
private void axGrid1_CellImageClick(object sender, AxEXGRIDLib._IGridEvents_CellImageClickEvent e) { axGrid1.Items.set_CellImage(e.item, e.colIndex, axGrid1.Items.get_CellImage(e.item, e.colIndex) % 2 + 1); }
The following VFP sample changes the cell's icon being clicked:
*** ActiveX Control Event *** LPARAMETERS item, colindex with thisform.Grid1.Items .DefaultItem = item .CellImage( 0,colindex ) = .CellImage( 0,colindex ) + 1 endwith