Property: Toolbars as Commands (read-only)
Dispatch Id: 1005
Description:
This property provides information about the structure of MapForceControl toolbars, as a Command object. The Command object contains all available toolbars of MapForce. To access the toolbars, use the SubCommands property of the Toolbars property. Each toolbar is also a Command object. For each toolbar, you can then further iterate through their SubCommands property in order to get their commands (this technique may be used, for example, to create the application's toolbars programmatically).
public void GetMapForceToolbars() { // Get the application toolbars from the MapForce ActiveX control assigned to the current form MapForceControlLib.MapForceCommands toolbars = this.axMapForceControl1.Toolbars; // Iterate through all toolbars for (int i = 0; i < toolbars.Count; i++) { MapForceControlLib.MapForceCommand toolbar = toolbars[i]; Console.WriteLine(); Console.WriteLine("The toolbar \"{0}\" has the following commands:", toolbar.Label); // Iterate through all commands of this toolbar for (int j = 0; j < toolbar.SubCommands.Count; j++) { MapForceControlLib.MapForceCommand cmd = toolbar.SubCommands[j]; // Output only command objects that are not separators if (!cmd.IsSeparator) { Console.WriteLine("{0}, {1}, {2}", cmd.ID, cmd.Name, cmd.Label.Replace("&", "")); } } } } |
C# example