Create toolbar menu

This sample demonstrates how to create a toolbar menu item and a submenu on this item using the Toolbar control in conjunction with the Map control and the control commands.
The AddItem method is used in the Form_Load event to add new items to the Toolbar control with their style set. A button can then be used to create an IMenuDef object from a menu defined in the same application. The menu is then added to the toolbar. The menu is defined in a class implementing the IMenuDef interface and is made up of default Toolbar control commands. Another button can be used to add a submenu to the menu that was just created.

How to use

See How to use ArcGIS samples for help on running the sample.

  1. Run the CreateNewToolbarMenu application.
  2. Open a map document.
  3. Click the Add Menu button on the RHS panel. A menu is added to the toolbar.
  4. Click the Add Sub Menu button. A submenu is added to the toolbar menu that was created in step 3.

If you installed the samples feature, you will find the files associated with this sample in <Your Developer Kit install location>\DeveloperKit10.4\Java\Samples\ArcObjects.

toolbarbean/ Sample source file.

Development licensing Deployment licensing
Engine Developer Kit Engine
ArcGIS for Desktop Basic
ArcGIS for Desktop Standard
ArcGIS for Desktop Advanced