ArcGIS Engine Development (i) zoom in, zoom out, roam, global, etc.

Source: Internet
Author: User

One: implementation function: Map zoom in, zoom out, roam, global

Second: Operation effect:

Three: The source code is as follows:

Using system;using system.collections.generic;using system.componentmodel;using system.data;using System.Drawing; Using System.text;using system.windows.forms;using ESRI. Arcgis.esrisystem;using ESRI. Arcgis.carto;using ESRI. Arcgis.controls;using ESRI. Arcgis.systemui;using ESRI. Arcgis.geometry;namespace lesson4{public partial class Form1:form {public Form1 () {Ini        Tializecomponent ();        } private void Form1_Load (object sender, EventArgs e) {loadmapdocument ();        } int flag = 0; Enlarge private void Button1_Click (object sender, EventArgs e) {axmapcontrol1.mousepointer = Esrico            Ntrolsmousepointer.esripointerzoomin;        flag = 2; }//Shrink private void button2_click (object sender, EventArgs e) {axMapControl1.            MousePointer = Esricontrolsmousepointer.esripointerzoomout;        flag = 1; }//Roaming private void button3_click (object sender, EventArgs e) {axmapcontrol1.mousepointer = Esricontrolsmousepointer.esripointerp            An        flag = 3; }//Full map private void Button4_Click (object sender, EventArgs e) {axmapcontrol1.extent = ax        Mapcontrol1.fullextent; }//load map document private void Loadmapdocument () {System.Windows.Forms.OpenFileDialog Openfiledi            Alog            OpenFileDialog = new OpenFileDialog ();            Openfiledialog.title = "Open map document";            Openfiledialog.filter = "Map documents (*.MXD) |*.mxd";            Openfiledialog.showdialog ();            string filePath = Openfiledialog.filename; if (Axmapcontrol1.checkmxfile (FilePath)) {Axmapcontrol1.mousepointer = Esricontrolsmousepointer                . Esripointerhourglass;                Axmapcontrol1.loadmxfile (FilePath, 0, Type.Missing); Axmapcontrol1.mousepointer = Esricontrolsmousepointer.esripointerdefault;            } else {MessageBox.Show (FilePath + "is not a valid map document");        }} private void Axmapcontrol1_onmousedown (object sender, Imapcontrolevents2_onmousedownevent e) {ESRI.            ArcGIS.Geometry.IEnvelope ipenv;                if (flag = = 2) {ipenv = Axmapcontrol1.trackrectangle ();            Axmapcontrol1.extent = ipenv;                } else if (flag = = 1) {//ipenv = Axmapcontrol1.trackrectangle ();                Ipenv = axmapcontrol1.extent;                Ipenv.expand (2,2, true);            Axmapcontrol1.extent = ipenv;                } else if (flag = = 3) {ipenv = axmapcontrol1.extent;            Axmapcontrol1.pan (); }        }    }}

The complete demo can be downloaded from the information I upload, and can also be consulted online qq937292955


ArcGIS Engine Development (i) zoom in, zoom out, roam, global, etc.

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.