event CellImageClick (Item as HITEM, ColIndex as Long)

Occurs when the user clicks the cell's icon.

 TypeDescription 
   Item as HITEM A long expression that indicates the handle of the item where the user clicks the cell's icon.  
   ColIndex as Long A long expression that indicates the index of the column where the user clicks the cell's icon, or a long  expression that indicates the handle of the cell being clicked, if the Item parameter is 0.  

The CellImageClick event is fired when user clicks on the cell's image. 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 determine the index of the icon being clicked, in case the cell displays multiple icons using the CellImages property. Use the CellHasCheckBox or CellHasRadioButton property to assign a check box or a radio button to a cell.

The following VB sample assigns an icon to each cell that's added, and changes the cell's icon when the user clicks the icon:

Private Sub Tree1_AddItem(ByVal Item As EXTREELibCtl.HITEM)
    Tree1.Items.CellImage(Item, 0) = 1
End Sub

Private Sub Tree1_CellImageClick(ByVal Item As EXTREELibCtl.HITEM, ByVal ColIndex As Long)
    Tree1.Items.CellImage(Item, ColIndex) = Tree1.Items.CellImage(Item, ColIndex) Mod 2 + 1
End Sub

The following VB sample displays the index of icon being clicked:

Private Sub Tree1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Dim i As HITEM, h As HitTestInfoEnum, c As Long
    With Tree1
        i = .ItemFromPoint(X / Screen.TwipsPerPixelX, Y / Screen.TwipsPerPixelY, c, h)
    End With
    If (i <> 0) or ( c <> 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 OnCellImageClickTree1(long Item, long ColIndex) 
{
	CItems items = m_tree.GetItems();
	COleVariant vtItem( Item ), vtColumn( ColIndex );
	items.SetCellImage( vtItem , vtColumn , items.GetCellImage( vtItem, vtColumn ) % 2 + 1 );
}

The following C# sample changes the cell's icon being clicked:

private void axTree1_CellImageClick(object sender, AxEXTREELib._ITreeEvents_CellImageClickEvent e)
{
	axTree1.Items.set_CellImage( e.item, e.colIndex, axTree1.Items.get_CellImage( e.item, e.colIndex ) % 2 + 1 );
}

The following VB/NET sample changes the cell's icon being clicked:

Private Sub AxTree1_CellImageClick(ByVal sender As Object, ByVal e As AxEXTREELib._ITreeEvents_CellImageClickEvent) Handles AxTree1.CellImageClick
	With AxTree1.Items
		.CellImage(e.item, e.colIndex) = .CellImage(e.item, e.colIndex) Mod 2 + 1
	End With
End Sub

The following VFP sample changes the cell's icon being clicked:

*** ActiveX Control Event ***
LPARAMETERS item, colindex

with thisform.Tree1.Items
	.DefaultItem = item
	.CellImage( 0,colindex ) = .CellImage( 0,colindex ) + 1
endwith

 


Send comments on this topic.
© 1999-2008 Exontrol Inc, Software. All rights reserved.