Command Class |
The Command type exposes the following members.
| Name | Description | |
|---|---|---|
| Caption | Display caption | |
| CommandType | The position where the the Command will be displayed in the user interface. | |
| Image | A 16x16 pixel image which will be displayed next to the command entry. | |
| IsChecked | Command is checked | |
| IsEnabled | Command is enabled | |
| IsVisible | Command is visible | |
| ShortcutKeys | User defined shortcut, which will be refered to the specified command. |
| Name | Description | |
|---|---|---|
| Click | The click handler | |
| Update | The update handler is called each time the application decides to update the state of the user interface. |
private void AddCommand() { Command cmd = Application.Current.Commands.CreateCommand(CommandType.Tools, "MyMenuEntry"); cmd.Click += new CommandEventHandler(cmd_Click); Application.Current.Commands.Add(cmd); } private void cmd_Click(object sender, CommandArgs e) { Document doc = e.Document; //Do something }