18.04.2015 Views

ArcGIS Engine Developer Guide

ArcGIS Engine Developer Guide

ArcGIS Engine Developer Guide

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

BUILDING APPLICATIONS WITH WINDOWS CONTROLS<br />

4. Build and run the application. To edit a map, layer, heading, or legend class<br />

label in the TOCControl, click it once, then click it a second time to invoke<br />

label editing. Try replacing the label with an empty string. You can use the Esc<br />

key on the keyboard at any time during the edit to cancel it.<br />

Navigating around the focus map using the map<br />

navigation tools will change the extent of the<br />

focus map in the PageLayoutControl and cause<br />

the MapControl to update. Navigating around<br />

the page layout with the page layout navigation<br />

tools will change the extent of the page layout<br />

(not the extent of the focus map in the<br />

PageLayoutControl), so the MapControl will<br />

not update.<br />

Drawing shapes on the MapControl<br />

You will now use the MapControl as an overview window and draw on its<br />

display the current extent of the focus map within the PageLayoutControl. As<br />

you navigate around the data within the data frame of the PageLayoutControl,<br />

you will see the MapControl overview window update.<br />

1. Add the following member variables to the class:<br />

public class Form1 : System.Windows.Forms.Form<br />

{<br />

private ESRI.<strong>ArcGIS</strong>.ToolbarControl.AxToolbarControl axToolbarControl1;<br />

private ESRI.<strong>ArcGIS</strong>.TOCControl.AxTOCControl axTOCControl1;<br />

private ESRI.<strong>ArcGIS</strong>.MapControl.AxMapControl axMapControl1;<br />

private ESRI.<strong>ArcGIS</strong>.PageLayoutControl.AxPageLayoutControl<br />

axPageLayoutControl1;<br />

The variable declared as visBoundsUpdatedE is<br />

a delegate. A delegate is a class that can hold a<br />

reference to a specific method and link this to a<br />

specific event. The linking process between the<br />

event and the method is sometimes known in<br />

.NET as wiring.<br />

private IToolbarMenu m_ToolbarMenu = new ToolbarMenuClass();<br />

private IEnvelope m_Envelope; // The envelope drawn on the MapControl<br />

private Object m_FillSymbol; // The symbol used to draw the envelope on<br />

the MapControl<br />

private ITransformEvents_VisibleBoundsUpdatedEventHandler<br />

visBoundsUpdatedE; // The PageLayoutControl's focus map events<br />

344 • <strong>ArcGIS</strong> <strong>Engine</strong> <strong>Developer</strong> <strong>Guide</strong>

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

Saved successfully!

Ooh no, something went wrong!