Commands Object (ICommands Interface)
This object provides access to the commands of a Visual Component. These commands can appear in the context menu of a component and in its toolbar (if exists). You can enable or disable commands and add custom commands for Visual Components. See Customizing the Context Menu and Toolbar of a Visual Component or details.
The following Visual Components allow you to manage their commands: ImageViewer, ZoomViewer, DocumentViewer, TextEditor. See the list of available commands and the ways these commands can be used in each component:
It's worth noting that Visual Basic users should not care for details of event interfaces implementation as this development platform provides easy means for handling them. This object may be declared WithEvents in Visual Basic.
For C++ user this fact means that it supports the IConnectionPointContainer interface. To receive notification events, a C++ user should create an object derived from the ICommandEvents interface, then set up the connection between it and events source implemented in Commands object by standard COM means.
|Count||int, read-only||Retrieves a number of commands available in the Visual Component.|
|Element||MenuItemEnum, read-only||Returns the identifier of the command with the specified index.|
|DisableCommand||Disables the specified command.|
|DoCommand||Executes the specified command in synchronous or asynchronous mode.|
|EnableCommand||Enables the specified command.|
|HasHotKey||Specifies whether the hot key is used by some command.|
|IsUserCommandRegistered||Specifies whether the specified user-defined command is registered.|
|RegisterUserCommand||Registers a user-defined command.|
|UnregisterUserCommand||Cancels the registration of the specified user-defined command.|
This object is used in the following code samples: VisualComponents.