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 />

In .NET a variable is fully qualified using a<br />

Namespace. Namespaces are a concept in .NET<br />

that allow objects to be organized hierarchically,<br />

regardless of the assembly they are defined in. To<br />

make code simpler and more readable, the<br />

directives act as shortcuts when referencing<br />

items specified in namespaces.<br />

Embedding the <strong>ArcGIS</strong> controls in a container<br />

Before you can access each control’s properties, methods, and events, each control<br />

needs embedding within a .NET container. Once the controls are embedded<br />

within the form, they will shape the application’s user interface.<br />

1. Open the .NET form in design mode.<br />

2. Double-click the AxMapControl in the Windows Forms tab of the toolbox to<br />

add a MapControl onto the form.<br />

3. Repeat to add the AxPageLayoutControl, AxTOCControl, and<br />

AxToolbarControl.<br />

4. Resize and reposition each control on the form as shown.<br />

Remember that C# is case sensitive. If you start<br />

by typing “ESRI.”, the auto completion feature of<br />

IntelliSense will allow you to complete the next<br />

section of code by pressing Tab.<br />

5. Double-click the form to display the form’s code window. Add the following<br />

“using” directives to the top of the code window:<br />

using System;<br />

using System.Windows.Forms;<br />

using ESRI.<strong>ArcGIS</strong>.SystemUI;<br />

using ESRI.<strong>ArcGIS</strong>.Carto;<br />

using ESRI.<strong>ArcGIS</strong>.Display;<br />

using ESRI.<strong>ArcGIS</strong>.Geometry;<br />

using esriToolbarControl;<br />

using esriTOCControl;<br />

Chapter 6 • <strong>Developer</strong> scenarios • 335

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

Saved successfully!

Ooh no, something went wrong!