public static void Pan() { esriControlsMousePointer mousePointer = m_pMapC2.MousePointer; m_pMapC2.MousePointer = esriControlsMousePointer.esriPointerPanning; m_pMapC2.Pan(); m_pMapC2.MousePointer = mousePointer; }
public override void OnMapControlMouseDown(int button, int shift, int x, int y, double mapX, double mapY) { base.OnMapControlMouseDown(button, shift, x, y, mapX, mapY); if (m_mapCtrl != null && button == 1) { esriControlsMousePointer tempPointer = m_mapCtrl.MousePointer; m_mapCtrl.MousePointer = esriControlsMousePointer.esriPointerPanning; GDDST.GIS.EsriUtils.ViewAgent.Pan(m_mapCtrl.ActiveView); m_mapCtrl.MousePointer = tempPointer; } }
private void EditMouseMove(IPoint pPnt) { if (m_editDispFeed != null) { m_mousePointer = esriControlsMousePointer.esriPointerSizeWE; IZAware pIZAware = null; pIZAware = pPnt as IZAware; pIZAware.ZAware = true; pPnt.Z = 0; m_editDispFeed.MoveTo(pPnt); } }
private void BindingMapMouseEvents() { #region 标事件 mapCtrl.OnMouseDown += delegate(object sender, IMapControlEvents2_OnMouseDownEvent e) { if (m_app == null || m_app.CurrentTool == null) { return; } switch (e.button) { case 4: esriControlsMousePointer tempPointer = mapCtrl.MousePointer; mapCtrl.MousePointer = esriControlsMousePointer.esriPointerPanning; GDDST.GIS.EsriUtils.ViewAgent.Pan(mapCtrl.ActiveView); mapCtrl.MousePointer = tempPointer; break; default: m_app.CurrentTool.OnMapControlMouseDown(e.button, e.shift, e.x, e.y, e.mapX, e.mapY); break; } }; mapCtrl.OnMouseMove += delegate(object sender, IMapControlEvents2_OnMouseMoveEvent e) { if (m_app == null || m_app.CurrentTool == null) { return; } m_app.CurrentTool.OnMapControlMouseMove(e.button, e.shift, e.x, e.y, e.mapX, e.mapY); }; mapCtrl.OnMouseUp += delegate(object sender, IMapControlEvents2_OnMouseUpEvent e) { if (m_app == null || m_app.CurrentTool == null) { return; } m_app.CurrentTool.OnMapControlMouseUp(e.button, e.shift, e.x, e.y, e.mapX, e.mapY); }; mapCtrl.OnDoubleClick += delegate(object sender, IMapControlEvents2_OnDoubleClickEvent e) { if (m_app == null || m_app.CurrentTool == null) { return; } m_app.CurrentTool.OnMapControlDblClick(e.button, e.shift, e.x, e.y, e.mapX, e.mapY); }; #endregion }
private void mapCtrlRight_OnMouseDown(object sender, IMapControlEvents2_OnMouseDownEvent e) { if (e.button == 4) { esriControlsMousePointer tempPointer = mapCtrlRight.MousePointer; mapCtrlRight.MousePointer = esriControlsMousePointer.esriPointerPagePanning; MapNavigation.Pan(mapCtrlRight.ActiveView); mapCtrlRight.MousePointer = tempPointer; return; } if (this.m_mapTool != null) { this.m_mapTool.OnMapControlMouseDown(mapCtrlRight.ActiveView, e.button, e.shift, e.x, e.y, e.mapX, e.mapY); } }
/// <summary> /// 设置鼠标样式 /// </summary> /// <param name="pointer"></param> public void SetMapcontrolMousePointer(esriControlsMousePointer pointer) { MyMapControl.MousePointer = pointer; }
public static void SetMapC2MouseStyle(esriControlsMousePointer mouse) { m_pMapC2.MousePointer = mouse; }
//主地图:鼠标点击(绘制图形、查询、数据编辑) private void axMapControlMainMap_OnMouseDown(object sender, IMapControlEvents2_OnMouseDownEvent e) { int statusFlag = CommonLib.MapMouseFlag; if (e.button == 2) { if (statusFlag <= 7) { _toolBarMenu.PopupMenu(e.x, e.y, axMapControlMainMap.hWnd); } } else if (e.button == 4) { esriControlsMousePointer pointer = axMapControlMainMap.MousePointer; axMapControlMainMap.MousePointer = esriControlsMousePointer.esriPointerPan; axMapControlMainMap.Pan(); axMapControlMainMap.MousePointer = pointer; } if (statusFlag <= 1) { return; } axMapControlMainMap.MousePointer = esriControlsMousePointer.esriPointerCrosshair;//鼠标指针:十字状 IPoint pPoint = axMapControlMainMap.ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(e.x, e.y); #region 8-9:测距离、测面积 if (statusFlag >= 8 && statusFlag <= 9) { measureResultPanel.Visible = true; switch (statusFlag) { case 8: //测距离 if (e.button == 1) { if (!_measureTool.IsSurveying) { _measureTool.LengthStart(axMapControlMainMap.ToMapPoint(e.x, e.y)); } else { _measureTool.AddPoint(axMapControlMainMap.ToMapPoint(e.x, e.y)); } } else { if (_measureTool.IsSurveying) { object lineSymbolObj = RenderOpt.GetSimpleLineSymbol("ff0000"); axMapControlMainMap.DrawShape(_measureTool.SurveyEnd(axMapControlMainMap.ToMapPoint(e.x, e.y)), ref lineSymbolObj); measureResultLabel.Text = "总长度:" + _measureTool.TotalLength.ToString("F2") + "米" + Environment.NewLine + Environment.NewLine; measureResultLabel.Text += "当前长度: " + _measureTool.CurrentLength.ToString("F2") + "米"; measureResultLabel.Refresh(); _measureTool.SurveyEnd(axMapControlMainMap.ToMapPoint(e.x, e.y)); } } break; case 9: //测面积 if (e.button == 1) { if (!_measureTool.IsSurveying) { _measureTool.AreaStart(axMapControlMainMap.ToMapPoint(e.x, e.y)); _areaPointCount = 1; } else { _measureTool.AddPoint(axMapControlMainMap.ToMapPoint(e.x, e.y)); _areaPointCount++; } } else { if (_measureTool.IsSurveying && _areaPointCount > 1) { object fillSymbolObj = RenderOpt.GetSimpleFillSymbol("99ccff", "ff0000"); axMapControlMainMap.DrawShape(_measureTool.SurveyEnd(axMapControlMainMap.ToMapPoint(e.x, e.y)), ref fillSymbolObj); measureResultLabel.Text = "面积:" + _measureTool.Area.ToString("#########.##") + "平方米"; measureResultLabel.Refresh(); _measureTool.SurveyEnd(axMapControlMainMap.ToMapPoint(e.x, e.y)); } } break; } } #endregion #region 11-19:空间查询(画点、线、面) else if (statusFlag >= 11 && statusFlag <= 19) { object symbol = null; switch (statusFlag) { case 11: CommonLib.MapGeometry = new PointClass { X = e.mapX, Y = e.mapY }; symbol = RenderOpt.GetSimpleMarkerSymbol("ff0000"); break; case 12: CommonLib.MapGeometry = axMapControlMainMap.TrackLine(); symbol = RenderOpt.GetSimpleLineSymbol("ff0000"); break; case 13: CommonLib.MapGeometry = axMapControlMainMap.TrackPolygon(); symbol = RenderOpt.GetSimpleFillSymbol("99ccff", "ff0000"); break; case 14: CommonLib.MapGeometry = axMapControlMainMap.TrackRectangle(); symbol = RenderOpt.GetSimpleFillSymbol("99ccff", "ff0000"); break; default: CommonLib.MapGeometry = null; break; } if (CommonLib.MapGeometry != null) { axMapControlMainMap.DrawShape(CommonLib.MapGeometry, ref symbol); } } #endregion }
public static void SetMousePointer(esriControlsMousePointer mousePointer) { m_pMapC2.MousePointer = mousePointer; }