Retrieves the item's ActiveX object associated, if the item was previously created by
InsertControlItem property.
Type | Description | |||
Item as HITEM | A long expression that indicates the handle of the item that was previously created by InsertControlItem property. | |||
Object | An object that indicates the ActiveX hosted by the item. |
Use the ItemObject to retrieve the ActiveX control created by the InsertControlItem method. 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 G2antt1 .BeginUpdate .ScrollBySingleLine = True With G2antt1.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_g2antt.GetItems(); m_g2antt.BeginUpdate(); m_g2antt.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_g2antt.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 ExG2antt Component:
axG2antt1.BeginUpdate(); EXG2ANTTLib.Items items = axG2antt1.Items; axG2antt1.ScrollBySingleLine = true; int h = items.InsertControlItem(0, "Exontrol.G2antt",""); items.set_ItemHeight(h, 182); object g2anttInside = items.get_ItemObject(h); if ( g2anttInside != null ) { EXG2ANTTLib.G2antt g2antt = g2anttInside as EXG2ANTTLib.G2antt; if (g2antt != null) { g2antt.BeginUpdate(); g2antt.LinesAtRoot = EXG2ANTTLib.LinesAtRootEnum.exLinesAtRoot; g2antt.Columns.Add("Column 1"); g2antt.Columns.Add("Column 2"); g2antt.Columns.Add("Column 3"); EXG2ANTTLib.Items itemsInside = g2antt.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"); g2antt.EndUpdate(); } } axG2antt1.EndUpdate();
The following VB.NET sample adds the Exontrol's ExOrgChart Component:
With AxG2antt1 .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.G2antt1 .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