How to use
See How to use ArcGIS samples for help on compiling, setting up the debugger, and running the sample. If the sample has associated data, you will find that the sample's zip file includes a "data" folder alongside the language folders. However, you will need to update the sample to point to the location of the data once you have extracted all the files.
- Browse to a map document to load into the MapControl.
- Navigate around the data using the commands on the ToolbarControl.
- Use the command buttons to add a menu item to the ToolbarControl, and a submenu to the menu item.
- Right-click the display to show the Navigation menu.
Additional information
The AddItem method is used within the Form_Load event to add new items to the ToolbarControl with their style set. An IMenuDef object is created from a menu defined within the same application. The menu is defined within a class implementing the IMenuDef interface and is made up of default ToolbarControl commands.
This menu is added to a ToolbarMenu using the AddItem method and the ToolbarMenu.Hook property is set to the ToolbarControl. A submenu is added to this menu using the IToolbarMenu.AddSubMenu method. The IToolbarMenu.PopupMenu method is used within the MapControl OnMouseDown event to display the menu when the right mouse button is used.
AssemblyInfo.cs | Assembly information. |
ToolbarMenu.cs | Form file. |
NavigationMenu.cs | Class file. |
ToolbarSubMenu.cs | Class file. |
AssemblyInfo.vb | Assembly information. |
ToolbarMenu.vb | Form file. |
NavigationMenu.vb | Class file. |
ToolbarSubMenu.vb | Class file. |
Download the files for all languages
See Also:
ToolbarControl classIToolbarControl interface
IToolbarMenu interface
IMenuDef interface
Development licensing | Deployment licensing |
---|---|
Engine Developer Kit | Engine |
ArcGIS for Desktop Basic | |
ArcGIS for Desktop Standard | |
ArcGIS for Desktop Advanced |