private void axMapControl2_OnMouseMove(object sender, IMapControlEvents2_OnMouseMoveEvent e) { if (e.mapX > Variable.pEnvelop.XMin && e.mapY > Variable.pEnvelop.YMin && e.mapX < Variable.pEnvelop.XMax && e.mapY < Variable.pEnvelop.YMax) { //如果鼠标移动到矩形框中,鼠标换成小手,表示可以拖动 EagelEyeMapControl.MousePointer = esriControlsMousePointer.esriPointerHand; if (e.button == 2)//如果在内部按下鼠标右键,将鼠标演示设置为默认样式 { EagelEyeMapControl.MousePointer = esriControlsMousePointer.esriPointerDefault; } } else { //在其他位置将鼠标设为默认的样式 EagelEyeMapControl.MousePointer = esriControlsMousePointer.esriPointerDefault; } if (Variable.bCanDrag) { double Dx, Dy; //记录鼠标移动的距离 Dx = e.mapX - Variable.pMoveRectPoint.X; Dy = e.mapY - Variable.pMoveRectPoint.Y; Variable.pEnvelop.Offset(Dx, Dy);//根据偏移量更改pEnvelop位置 Variable.pMoveRectPoint.PutCoords(e.mapX, e.mapY); EagleEyeClass.DrawRectangle(Variable.pEnvelop); Variable.pMapFrm.mainMapControl.Extent = Variable.pEnvelop; } }
// 显示鹰眼窗口 private void barButtonItem10_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (Variable.pMapFrm.mainMapControl.Map.LayerCount == 0) { Variable.pEnvelop = Variable.pEagleEyeMapFrm.EagelEyeMapControl.FullExtent; } this.ShowEagleEye(); EagleEyeClass.SynchronizeEagleEye(); EagleEyeClass.DrawRectangle(Variable.pEnvelop); }
private void axMapControl1_OnExtentUpdated(object sender, IMapControlEvents2_OnExtentUpdatedEvent e) { if (Variable.pEagleEyeMapFrm == null || Variable.pEagleEyeMapFrm.IsDisposed) { Variable.pEnvelop = e.newEnvelope as IEnvelope; } else { Variable.pEnvelop = (IEnvelope)e.newEnvelope; EagleEyeClass.DrawRectangle(Variable.pEnvelop); } }
// 显示地图窗口 public void ShowMapFrm() { if (Variable.pMapFrm == null || Variable.pMapFrm.IsDisposed) { Variable.pMapFrm = new MapFrm(); Variable.pMapFrm.CurrentTool = MapTools.None; this.ShowDockContent(Variable.pMapFrm, DockState.Document); EagleEyeClass.SynchronizeEagleEye(); } else { this.ShowDockContent(Variable.pMapFrm, DockState.Document); EagleEyeClass.SynchronizeEagleEye(); } }
private void axMapControl1_OnKeyDown(object sender, IMapControlEvents2_OnKeyDownEvent e) { EagleEyeClass.SynchronizeEagleEye(); }
private void axMapControl1_OnMapReplaced(object sender, IMapControlEvents2_OnMapReplacedEvent e) { EagleEyeClass.SynchronizeEagleEye(); }