event CellImageClick (Cell as HCELL)

Fired after the user clicks on the image's cell area.

 TypeDescription 
   Cell as HCELL  A long expression that indicates the handle of the cell where the user clicks the cell's image.  

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. The following sample changes the cell's image when the user has clicked on the cell's image ( to run the following sample you have to add two images to the tree's images collection. ). 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 ComboBox1_InsertItem(ByVal Item As EXCOMBOBOXLibCtl.HITEM)
    ComboBox1.Items.CellImage(Item, 0) = 1
End Sub

Private Sub ComboBox1_CellImageClick(ByVal Cell As EXCOMBOBOXLibCtl.HCELL)
    ComboBox1.Items.CellImage(, Cell) = ComboBox1.Items.CellImage(, Cell) Mod 2 + 1
End Sub

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

Private Sub ComboBox1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Dim i As HITEM, h As HitTestInfoEnum, c As Long
    With ComboBox1
        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 OnCellImageClickCombobox1(long Cell) 
{
	CItems items = m_combobox.GetItems();
	COleVariant vtMissing; V_VT( &vtMissing ) = VT_ERROR;
	COleVariant vtColumn( Cell );
	items.SetCellImage( vtMissing , vtColumn , items.GetCellImage( vtMissing, vtColumn ) % 2 + 1 );	
}

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

private void axComboBox1_CellImageClick(object sender, AxEXCOMBOBOXLib._IComboBoxEvents_CellImageClickEvent e)
{
	axComboBox1.Items.set_CellImage(null, e.cell, axComboBox1.Items.get_CellImage(null, e.cell) % 2 + 1);
}

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

Private Sub AxComboBox1_CellImageClick(ByVal sender As Object, ByVal e As AxEXCOMBOBOXLib._IComboBoxEvents_CellImageClickEvent) Handles AxComboBox1.CellImageClick
    With AxComboBox1.Items
        .CellImage(Nothing, e.cell) = .CellImage(Nothing, e.cell) Mod 2 + 1
    End With
End Sub

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

*** ActiveX Control Event ***
LPARAMETERS cell

with thisform.ComboBox1.Items
	.DefaultItem = .CellItem(cell)
	.CellImage( 0,0 ) = .CellImage( 0,0 ) + 1
endwith



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