![]() |
This document is archived and information here might be outdated. Recommended version. |
Returns the index of the first item containing the given command. Returns -1 if it is not found.
[Visual Basic .NET] Public Function Find ( _ ByVal item As Object _ ) As Integer
[C#] public int Find ( object item );
[C++]
HRESULT Find(
VARIANT item
);
[C++]
Parameters item [in]
item is a parameter of type VARIANT
Returns the index of the first item on the ToolbarPalette using the specified IUid, ProgID, ICommand. If the specified command cannot be found -1 is returned.
To find an Item on the ToolbarPalette using a Command implementing ICommandSubType pass a UID with its SubType property set.
longlindex; UID uID;//Get a toolbar itemIToolbarItem2 toolbarItem=(IToolbarItem2) axToolbarControl1.GetItem(0);//Get the palette from the itemIToolbarPalette toolbarPalette=toolbarItem.Palette;if(toolbarPalette ==null) return;//Find an Item on the palette by passing a ProgIDlIndex=toolbarPalette.Find("esriControls.ControlsMapZoomInTool");//Find an Item on the palette by passing a UIDuID=newUIDClass(); uID.Value="esriControls.ControlsMapZoomInTool"; lIndex=toolbarPalette.Find(uID);//Find an Item on the palette by passing a UID with subtype setuID=newUIDClass(); uID.Value="esriControls.ControlsInkHighlightTool"; uID.SubType=2; lIndex=toolbarPalette.Find(uID);
DimlIndexAs Long, uIDAsUID'Get a toolbar itemDimtoolbarItemAsIToolbarItem2 toolbarItem=AxToolbarControl1.GetItem(0)'Get the palette from the itemDimtoolbarPaletteAsIToolbarPalette toolbarPalette=toolbarItem.PaletteIftoolbarPaletteIs Nothing Then Exit Sub'Find an Item on the palette by passing a ProgIDlIndex=toolbarPalette.Find("esriControls.ControlsMapZoomInTool")'Find an Item on the palette by passing a UIDuID=NewUIDClass uID.Value="esriControls.ControlsMapZoomInTool" lIndex=toolbarPalette.Find(uID)'Find an Item on the palette by passing a UID with subtype setuID=NewUIDClass uID.Value="esriControls.ControlsInkHighlightTool" uID.SubType=2 lIndex=toolbarPalette.Find(uID)