ArcObjects Library Reference (Framework)  

ICommandItem Interface

Provides access to members that define a command item.

Product Availability

Available with ArcGIS Desktop.

When To Use

A CommandItem is any item on a commandbar. For example, buttons, tools, and menu items that appear on commandbars are all commanditems. The ICommandItem interface allows you to get or set the properties of the commanditem such as caption, button image, statusbar message, tooltip, display style, help context ID, and more. The ICommandItem interface also provides methods to execute, delete, refresh, and reset the commanditem. Use ICommandBars::Find, ICommandBar::Find, or ICommandBar::Item to obtain a reference to a particular commanditem.


Read/write property Action The name of the VBA macro this command should run when pressed.
Read-only property BuiltIn Indicates whether this command item is built-in or if it was implemented through VBA.
Read/write property Caption The caption of this command item.
Read-only property Category The name of the category with which this command item is associated.
Read-only property Command A reference to the internal command object.
Method Delete Removes this object from the commandbar.
Method Execute Causes the command to execute.
Read/write property FaceID The bitmap that is used as the icon on this command item.
Read/write property Group Indicates if this command item begins a menu or toolbar group.
Read/write property HelpContextID The help context ID associated with this command item.
Read/write property HelpFile The help file associated with this command item.
Read-only property ID The unique integer ID associated with this command item.
Read-only property Index The positional index of this command item within its menu or toolbar.
Read/write property Message The status bar message for this command item.
Read/write property Name The name of this command item.
Read-only property Parent The menu or toolbar that this command item currently resides on.
Method Refresh Causes the command to be redrawn.
Method Reset Restores this command item's properties to that of the original.
Read/write property Style The display style of this command item.
Read/write property Tag The tag for this command item.
Read/write property Tooltip The tooltip for this command item.
Read-only property Type The type of this command item.

CoClasses that implement ICommandItem

CoClasses and Classes Description
CommandBar CommandBar object.
CommandItem Command Item.

See Also

ICommandBar.Popup Method | ICommandBar.Find Method | ICommandBar.Add Method | ICommandBar.Item Property | ICommandBar.CreateMacroItem Method | ICommandBars.Find Method

.NET Snippets

Find Command and Execute | Get Toolbar by Name | List ArcMap Visible Toolbars | Get Command on Toolbar by Names | Statements - Use a Tool in a Windows Form | Get Command by Name | Set Tool Active in ToolBar | Use Custom Tool on Windows Form

.NET Samples

Custom subtyped command and tool (Code Files: ZoomInCommands) | Applying user interface customizations at startup (Code Files: AcmeExt) | Simple logging dockable window with a custom context menu (Code Files: LoggingDockableWindow)

.NET Related Topics

How to create multiple commands or tools in a single class subtyped command