- int flag = 0;
- private void btnZoomIn_Click(object sender, EventArgs e)
- {
- axMapControl1.MousePointer = esriControlsMousePointer.esriPointerZoomIn;
- flag = 2;
- }
- private void brnZoomOut_Click(object sender, EventArgs e)
- {
- axMapControl1.MousePointer = esriControlsMousePointer.esriPointerZoomOut;
- flag = 1;
- }
- private void btnPan_Click(object sender, EventArgs e)
- {
- axMapControl1.MousePointer = esriControlsMousePointer.esriPointerPan;
- flag = 3;
- }
- private void btnFullExtent_Click(object sender, EventArgs e)
- {
- axMapControl1.Extent = axMapControl1.FullExtent;
- }
- private void axMapControl1_OnMouseDown(object sender, IMapControlEvents2_OnMouseDownEvent e)
- {
- IEnvelope ipEnv;
- if (flag == 2)
- {
- ipEnv = axMapControl1.TrackRectangle();
- ipEnv = axMapControl1.Extent;
- ipEnv.Expand(0.5, 0.5, true);
- 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)
- {
- axMapControl1.Pan();
- }
- }
放大、缩小、平移、全图
最新推荐文章于 2019-12-20 17:42:15 发布