C # to make Eagle's eye in a detailed whole process (with annotations) instance Code _c# tutorial

Source: Internet
Author: User

AxMapControl1 is the main control, AxMapControl2 is an eagle eye control

To see the event response

1. Eagle Eye Map Resource Loading

Copy Code code as follows:

Privatevoid axmapcontrol1_onmapreplaced (object sender, Imapcontrolevents2_onmapreplacedevent e)

{

When the main map shows the control's map to be replaced, the map in the Eagle's eye follows the replacement

Axmapcontrol2.loadmxfile (Axmapcontrol1.documentfilename);

Axmapcontrol2.extent = axmapcontrol2.fullextent;

}


2. Draw the eagle eye rectangular frame
Copy Code code as follows:

private void Axmapcontrol1_onextentupdated (object sender, Imapcontrolevents2_onextentupdatedevent e)

{

Get a new range

Ienvelope penv = (ienvelope) e.newenvelope;

Igraphicscontainer Pgra = Axmapcontrol2.map as Igraphicscontainer;

Iactiveview pAv = Pgra as Iactiveview;

Clears any graphic element in the AxMapControl2 before drawing

Pgra.deleteallelements ();

Irectangleelement Prectangleele = new Rectangleelementclass ();

IElement PEle = Prectangleele as ielement;

Pele.geometry = penv;

Set the Red Line box in the Eagle's eye chart

Irgbcolor Pcolor = new Rgbcolorclass ();

pcolor.red = 255;

Pcolor.green = 0;

Pcolor.blue = 0;

Pcolor.transparency = 255;

Produces a line symbol object

Ilinesymbol poutline = new Simplelinesymbolclass ();

Poutline.width = 2;

Poutline.color = Pcolor;

Set color Properties

Pcolor = new Rgbcolorclass ();

pcolor.red = 255;

Pcolor.green = 0;

Pcolor.blue = 0;

pcolor.transparency = 0;

Set the properties of a fill symbol

Ifillsymbol Pfillsymbol = new Simplefillsymbolclass ();

Pfillsymbol.color = Pcolor;

Pfillsymbol.outline = Poutline;

Ifillshapeelement Pfillshapeele = PEle as ifillshapeelement;

Pfillshapeele.symbol = Pfillsymbol;

Pgra.addelement ((ielement) pfillshapeele, 0);

Pav.partialrefresh (esriviewdrawphase.esriviewgraphics, NULL, NULL);

}


3. Achieving interaction
Copy Code code as follows:

private void Axmapcontrol2_onmousedown (object sender, Imapcontrolevents2_onmousedownevent e)

{

IPoint ppt=new Pointclass ();

Ppt.putcoords (E.MAPX, e.mapy);

Change the view scope of the main control

AxMapControl1. Centerat (pPt);

}


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.