![]() | Type | Description | ||
| Item as HITEM | A long expression that specifies the handle of the item that is expanded or collapsed. |
The AfterExapndItem event notifies your application that an item is collapsed or expanded. Use the ExpandItem method to programmatically expand or collapse an item. The ExpandItem property also specifies whether an item is expand or collapsed. The ItemChild property retrieves the first child item. Use the BeforeExpandItem event to cancel expanding or collapsing items
The following VB sample displays whether an item is expanded or collapsed:
Private Sub Grid1_AfterExpandItem(ByVal Item As EXGRIDLibCtl.HITEM)
With Grid1.Items
Debug.Print "Item is " & IIf(.ExpandItem(Item), "expanded", "collapsed") & "."
End With
End SubThe following C++ sample prints the item's state when it is expanded or collapsed:
#include "Items.h"
void OnAfterExpandItemGrid1(long Item)
{
if ( ::IsWindow( m_grid.m_hWnd ) )
{
CItems items = m_grid.GetItems();
CString strFormat;
strFormat.Format( "%s", items.GetExpandItem( Item ) ? "expanded" : "collapsed" );
OutputDebugString( strFormat );
}
}The following C# sample prints the item's state when it is expanded or collapsed:
private void axGrid1_AfterExpandItem(object sender, AxEXGRIDLib._IGridEvents_AfterExpandItemEvent e)
{
System.Diagnostics.Debug.WriteLine(axGrid1.Items.get_ExpandItem(e.item) ? "expanded" : "collapsed");
}The following VB.NET sample prints the item's state when it is expanded or collapsed:
Private Sub AxGrid1_AddItem(ByVal sender As Object, ByVal e As AxEXGRIDLib._IGridEvents_AddItemEvent) Handles AxGrid1.AddItem AxGrid1.Items.ItemForeColor(e.item) = ToUInt32(Color.Blue) End Sub
The following VFP sample prints the item's state when it is expanded or collapsed:
*** ActiveX Control Event *** LPARAMETERS item with thisform.Grid1.Items if ( .ExpandItem(item) ) wait window "expanded" nowait else wait window "collapsed" nowait endif endwith