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.
long
lindex; UID uID;//Get a toolbar item
IToolbarItem2 toolbarItem=(IToolbarItem2) axToolbarControl1.GetItem(0);//Get the palette from the item
IToolbarPalette toolbarPalette=toolbarItem.Palette;if
(toolbarPalette ==null
) return;//Find an Item on the palette by passing a ProgID
lIndex=toolbarPalette.Find("esriControls.ControlsMapZoomInTool");//Find an Item on the palette by passing a UID
uID=new
UIDClass(); uID.Value="esriControls.ControlsMapZoomInTool"; lIndex=toolbarPalette.Find(uID);//Find an Item on the palette by passing a UID with subtype set
uID=new
UIDClass(); uID.Value="esriControls.ControlsInkHighlightTool"; uID.SubType=2; lIndex=toolbarPalette.Find(uID);
Dim
lIndexAs Long
, uIDAs
UID'Get a toolbar item
Dim
toolbarItemAs
IToolbarItem2 toolbarItem=AxToolbarControl1.GetItem(0)'Get the palette from the item
Dim
toolbarPaletteAs
IToolbarPalette toolbarPalette=toolbarItem.PaletteIf
toolbarPaletteIs Nothing Then Exit Sub
'Find an Item on the palette by passing a ProgID
lIndex=toolbarPalette.Find("esriControls.ControlsMapZoomInTool")'Find an Item on the palette by passing a UID
uID=New
UIDClass uID.Value="esriControls.ControlsMapZoomInTool" lIndex=toolbarPalette.Find(uID)'Find an Item on the palette by passing a UID with subtype set
uID=New
UIDClass uID.Value="esriControls.ControlsInkHighlightTool" uID.SubType=2 lIndex=toolbarPalette.Find(uID)