ArcGISEngine implements zooming in, zooming out and panning on the map:
Personally, I think it is panning, but the Internet is all roaming. In layman's terms, it is just pulling a map object from one side to the other. Just watch what people say.
Implementation:
First, the introduction of namespace
using ESRI.ArcGIS.Geometry;
using ESRI.ArcGIS.Controls;
Second, the code implementation.
int flag = 0; private void 放大ToolStripMenuItem_Click(object sender, EventArgs e){ axMapControl1.MousePointer = esriControlsMousePointer.esriPointerPageZoomIn; flag = 1; } private void 缩小ToolStripMenuItem_Click(object sender, EventArgs e){ axMapControl1.MousePointer = esriControlsMousePointer.esriPointerPageZoomOut; flag = 2; } private void 平移ToolStripMenuItem_Click(object sender, EventArgs e){ axMapControl1.MousePointer = esriControlsMousePointer.esriPointerPan; flag = 3; } private void axMapControl1_OnMouseDown(object sender, IMapControlEvents2_OnMouseDownEvent e){ IEnvelope ipenv= axMapControl1.TrackRectangle(); if(flag==1){ axMapControl1.Extent = ipenv; }else if(flag==2){ ipenv = axMapControl1.Extent; ipenv.Expand(2, 2, true); axMapControl1.Extent = ipenv; }else if(flag==3){ ipenv= axMapControl1.Extent ; axMapControl1.Pan(); } } }
3. Supplement:
In AE, when adding .jpg and .bmp type layer files to the map control, it is much simpler to call the following method.
IRasterLayer rasterLayer = new RasterLayer(); rasterLayer.CreateFromFilePath(str); axMapControl1.AddLayer (rasterLayer, 0);
where str is the file path.