Build an ArcGIS controls map viewer application

The MapControl, PageLayoutControl, TOCControl, and ToolbarControl are used in conjunction with other ArcObjects and the control commands to create a map viewer application. This sample complements the ArcGIS Engine Controls topic.
This sample demonstrates how to do the following:
  • Load pre-authored map documents into the PageLayoutControl and MapControl using the CheckMxFile and LoadMxFile methods.
  • Set the ToolbarControl and TOCControl buddy control to be the PageLayoutControl using the SetBuddyControl method.
  • Add a suite of map and page navigation control commands to the ToolbarControl using the AddItem method.
  • Create a pop-up menu from the control commands that works with the PageLayoutControl and displays as a right-click context menu.
  • Manage the way map and layer labels are edited in the TOCControl using the LabelEdit property and the ITOCControlEvents.onEndLabelEdit event.
  • Use the MapControl as an overview window by using the DrawShape method to highlight the current extent of data in the PageLayoutControl.
  • Create a custom Add Date command that works with the PageLayoutControl, ToolbarControl, and MapControl using the HookHelper object.
  • Customize the ToolbarControl with the Customize property and display the CustomizeDialog to the end user at run time.

How to use

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

  1. Run the application.
  2. Use the Open Document command on the ToolbarControl to browse to a pre-authored map document to load into the PageLayoutControl.
  3. Use the commands and tools on the ToolbarControl to navigate around the map document.
  4. Right-click the PageLayoutControl to display the pop-up menu.
  5. Use the custom Add Date tool to add an element to the PageLayoutControl containing the current date.
  6. Double-click a map or layer label in the TOCControl to edit the label.
  7. Customize the ToolbarControl by adding new commands, toolsets, or menus from the CustomizeDialog.
  8. To alter the appearance of an existing item on the ToolbarControl, right-click the item to display the context menu.

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.


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