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.