Retrieves the item's ActiveX object, if the item was previously created by
InsertControlItem property, or the original object being used when calling the
InsertObjectItem property.
Type | Description | |||
Item as HITEM | A long expression that indicates the item's handle that was previously created by InsertControlItem or InsertObjectItem property. | |||
Variant | An object that represents the ActiveX hosted by the item |
The ItemObject retrieves the ActiveX object being created by the InsertControlItem method, or the object being hosted when using the InsertObjectItem property. Use the ItemControlID property to retrieve the control's identifier. Use the ItemHeight property to specify the item's height. If the item hosts an ActiveX control, the ItemHeight property specifies the height of the ActiveX control also.
The following VB sample adds the Exontrol's ExCalendar Component:
With Grid1 .BeginUpdate .ScrollBySingleLine = True With Grid1.Items Dim h As HITEM h = .InsertControlItem(, "Exontrol.Calendar") .ItemHeight(h) = 182 With .ItemObject(h) .Appearance = 0 .BackColor = vbWhite .ForeColor = vbBlack .ShowTodayButton = False End With End With .EndUpdate End With
The following C++ sample adds the Exontrol's ExOrgChart Component:
#include "Items.h" #pragma warning( disable : 4146 ) #import <ExOrgChart.dll> CItems items = m_grid.GetItems(); m_grid.BeginUpdate(); m_grid.SetScrollBySingleLine( TRUE ); COleVariant vtMissing; V_VT( &vtMissing ) = VT_ERROR; long h = items.InsertControlItem( 0, "Exontrol.ChartView", vtMissing ); items.SetItemHeight( h, 182 ); EXORGCHARTLib::IChartViewPtr spChart( items.GetItemObject(h) ); if ( spChart != NULL ) { spChart->BeginUpdate(); spChart->BackColor = RGB(255,255,255); spChart->ForeColor = RGB(0,0,0); EXORGCHARTLib::INodesPtr spNodes = spChart->Nodes; spNodes->Add( "Child 1", "Root", "1", vtMissing, vtMissing ); spNodes->Add( "SubChild 1", "1", vtMissing, vtMissing, vtMissing ); spNodes->Add( "SubChild 2", "1", vtMissing, vtMissing, vtMissing ); spNodes->Add( "Child 2", "Root", vtMissing, vtMissing, vtMissing ); spChart->EndUpdate(); } m_grid.EndUpdate();
The sample uses the #import statement to include the ExOrgChart's Type Library. In this sample, the ItemObject property retrieves an IChartView object. The path to the library should be provided in case it is not located in your system folder.
The following C# sample adds the Exontrol's ExGrid Component:
axGrid1.BeginUpdate(); EXGRIDLib.Items items = axGrid1.Items; axGrid1.ScrollBySingleLine = true; int h = items.InsertControlItem(0, "Exontrol.Grid", ""); items.set_ItemHeight(h, 182); object gridInside = items.get_ItemObject(h); if (gridInside != null) { EXGRIDLib.Grid grid = gridInside as EXGRIDLib.Grid; if (grid != null) { grid.BeginUpdate(); grid.LinesAtRoot = EXGRIDLib.LinesAtRootEnum.exLinesAtRoot; grid.Columns.Add("Column 1"); grid.Columns.Add("Column 2"); grid.Columns.Add("Column 3"); EXGRIDLib.Items itemsInside = grid.Items; int hInside = itemsInside.AddItem("Item 1"); itemsInside.set_CellValue(hInside, 1, "SubItem 1"); itemsInside.set_CellValue(hInside, 2, "SubItem 2"); hInside = itemsInside.InsertItem(hInside, null, "Item 2"); itemsInside.set_CellValue(hInside, 1, "SubItem 1"); itemsInside.set_CellValue(hInside, 2, "SubItem 2"); grid.EndUpdate(); } } axGrid1.EndUpdate();
The following VB.NET sample adds the Exontrol's ExOrgChart Component:
With AxGrid1 .BeginUpdate() .ScrollBySingleLine = True With .Items Dim hItem As Integer hItem = .InsertControlItem(, "Exontrol.ChartView") .ItemHeight(hItem) = 182 With .ItemObject(hItem) .BackColor = ToUInt32(Color.White) .ForeColor = ToUInt32(Color.Black) With .Nodes .Add("Child 1", , "1") .Add("SubChild 1", "1") .Add("SubChild 2", "1") .Add("Child 2") End With End With End With .EndUpdate() End With
The following VFP sample adds the Exontrol's ExGrid Component:
with thisform.Grid1 .BeginUpdate() .ScrollBySingleLine = .t. with .Items .DefaultItem = .InsertControlItem(0, "Exontrol.Grid") .ItemHeight( 0 ) = 182 with .ItemObject( 0 ) .BeginUpdate() with .Columns with .Add("Column 1").Editor() .EditType = 1 && EditType editor endwith endwith with .Items .AddItem("Text 1") .AddItem("Text 2") .AddItem("Text 3") endwith .EndUpdate() endwith endwith .EndUpdate() endwith