18.04.2015 Views

ArcGIS Engine Developer Guide

ArcGIS Engine Developer Guide

ArcGIS Engine Developer Guide

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

WORKING WITH THE ARCGIS CONTROLS<br />

methods and allow you, as a developer, to build an application with little or no<br />

code.<br />

ArcObjects<br />

Each <strong>ArcGIS</strong> control simplifies the development process by encapsulating coarsegrained<br />

ArcObjects while still providing access to finer-grained ArcObjects. For<br />

example, the PageLayoutControl encapsulates the PageLayout object. The PageLayout<br />

contains at least one MapFrame element containing a Map, and the Map may<br />

contain multiple raster, feature, or custom Layer objects. Each <strong>ArcGIS</strong> control<br />

provides shortcuts to frequently used properties and methods on the ArcObjects<br />

they encapsulate. For example, the MapControl has a SpatialReference property that<br />

is a shortcut to the SpatialReference property of the Map object. Each <strong>ArcGIS</strong><br />

control also has some helper methods that perform common tasks. For example,<br />

the MapControl has an AddShapeFile method. The <strong>ArcGIS</strong> controls are typically a<br />

starting point for developing applications because they provide not only a user<br />

interface but also a direct route into the object model.<br />

For more details on how the controls work<br />

together, see the ‘TOCControl and<br />

ToolbarControl’ section later in this chapter.<br />

Events<br />

Each <strong>ArcGIS</strong> control fires events in response to keyboard and mouse interactions<br />

by the end user. Other events fire in response to actions occurring within the<br />

controls. For example, when a map document is loaded into the MapControl, the<br />

OnMapReplaced event is fired, or when an object is dragged over the MapControl<br />

via drag and drop, the OnOleDrop event is fired.<br />

Buddy Controls<br />

The ToolbarControl and TOCControl each work in conjunction with one other<br />

‘buddy control’. Typically, the buddy control is a MapControl, PageLayoutControl,<br />

ReaderControl, SceneControl, or GlobeControl. The buddy control can be set at design<br />

time through the control property pages (in development environments that<br />

support property page capability) or programmatically using SetBuddyControl.<br />

Map authoring<br />

The <strong>ArcGIS</strong> Desktop applications can be used to preauthor documents that can<br />

be loaded into the <strong>ArcGIS</strong> controls to quickly produce high-quality mapping. For<br />

example, ArcMap can be used to author map documents that can be loaded into<br />

the MapControl and PageLayoutControl. Preauthoring documents can substantially<br />

reduce your development time as it saves having to programmatically build up<br />

maps and symbology from scratch. Once a document is loaded into an <strong>ArcGIS</strong><br />

control, any layer, element, and symbol can be accessed programmatically through<br />

the object model if its appearance subsequently needs changing.<br />

You can also save the contents of your controls to map documents using the<br />

MapDocument class with the MapControl or PageLayoutControl. The documents can<br />

then be reopened by the control or by ArcMap. Using this technique it is possible<br />

to share documents between your custom application and <strong>ArcGIS</strong> Desktop. For<br />

Chapter 3 • Developing with <strong>ArcGIS</strong> controls • 43

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!