Pitney Bowes MapXtreme User Manual

Page 132

Advertising
background image

Chapter 7: Desktop Applications, Controls, Dialogs, and Tools

Key Controls to Use in Desktop Applications

MapXtreme v7.1

132

Developer Guide

5. Click OK.

The MapToolBarButton is now created and added to the button bar. The newly added tool works
in the default manner.

Adding Custom Buttons to a ToolBar

This procedure assumes you have created a custom tool and added it to the MapControl.Tools
collection. Adding custom buttons involves assigning the button’s ToolId to the name of the custom
tool and adding a custom bitmap to the MapToolBar’s ImageList.

For information on how to create a custom desktop tool, see

Customizing Tools.

For information on custom bitmap symbols that ship with MapXtreme see

Appendix F: Custom

Symbols

.

To add a custom button to a toolbar:

1. Add a MapToolBar to your form.

2. In the Visual Studio property window, highlight the Buttons property and press the ... button to

invoke the ToolBarButton Collection Editor dialog

3. Click the Add button to add a new MapToolBarButton.

4. Set the button's ButtonType property to CustomTool (last item the drop-down list). Note that the

button will now appear blank, as there is no image associated with the custom button yet.

5. Set the button's ToolId property to the name of the custom tool you added to the MapControl's

Tools collection. If the ToolId value does not match a tool in the collection, then a runtime
exception will be thrown when the user clicks the button.

6. Click OK to close the ToolBarButton Collection Editor dialog.

Advertising