Returns the item at the specified index from the ToolbarPalette.
[Visual Basic .NET] Public Function GetItem ( _ ByVal index As Integer _ ) As IToolbarItem
[C#] public IToolbarItem GetItem ( int index );
[C++]
HRESULT GetItem(
long index,
IToolbarItem** item
);
[C++]Parameters
index [in] index is a parameter of type long item [out, retval]item is a parameter of type IToolbarItem
Product Availability
Available with ArcGIS Engine.
Description
The property is used to access a particular item on the ToolbarPalette. The item at the top of the menu has an index of 0.
Errors Returned
1023 800a03ff: The specified index is out of range
Remarks
To loop through a ToolbarPalette item collection use the GetItem method in conjunction with the Count property.
[C#]
//Get a toolbar itemIToolbarItem2 toolbarItem = (IToolbarItem2) axToolbarControl1.GetItem(0);//Get the palette from the itemIToolbarPalette toolbarPalette = toolbarItem.Palette;if(toolbarPalette ==null) return; toolbarItem = (IToolbarItem2) toolbarPalette.GetItem(0);//First ItemtoolbarItem = (IToolbarItem2) toolbarPalette.GetItem(1);//Second ItemtoolbarItem = (IToolbarItem2) toolbarPalette.GetItem(toolbarPalette.Count - 1);//Last Itemfor(inti=0; i<= toolbarPalette.Count-1; i++) { toolbarItem = (IToolbarItem2) toolbarPalette.GetItem(i);//do something..}
[Visual Basic .NET]
'Get a toolbar itemDimtoolbarItemAsIToolbarItem2 toolbarItem = AxToolbarControl1.GetItem(0)'Get the palette from the itemDimtoolbarPaletteAsIToolbarPalette toolbarPalette = toolbarItem.PaletteIftoolbarPaletteIs Nothing Then Exit SubtoolbarItem = toolbarPalette.GetItem(0)'First ItemtoolbarItem = toolbarPalette.GetItem(1)'Second ItemtoolbarItem = toolbarPalette.GetItem(toolbarPalette.Count - 1)'Last ItemDimiAs Long Fori = 0TotoolbarPalette.Count - 1 toolbarItem = toolbarPalette.GetItem(i)'Do something..Nexti