先看看效果过图

实现是上图的效果主要需要用到axMapControl1_OnMouseDown事件,在点击事件中判断是点击的右键还是左键,进行弹出

直接贴代码:

      private void axMapControl1_OnMouseDown(object sender, IMapControlEvents2_OnMouseDownEvent e){#region  主窗体右键/地图视窗鼠标事件IToolbarMenu mapPopMenu = null;mapPopMenu = new ToolbarMenu();//这个很关键,主要应用SDK封装的工具类似于C#的OpenDialogif (e.button == 2){/* IMap pMap = axMapControl1.Map;IActiveView pActiveView = pMap as IActiveView;IEnvelope pEnv = axMapControl1.TrackRectangle();pActiveView.Extent = pEnv;pActiveView.Refresh();*///地图视窗右键菜单功能mapPopMenu.AddItem(new ControlsSelectTool(), -1, 0, false, esriCommandStyles.esriCommandStyleIconAndText);mapPopMenu.AddItem(new ControlsMapPanTool(), -1, 1, false, esriCommandStyles.esriCommandStyleIconAndText);mapPopMenu.AddItem(new ControlsMapFullExtentCommand(), -1, 2, false, esriCommandStyles.esriCommandStyleIconAndText);mapPopMenu.AddItem(new ControlsMapIdentifyTool(), -1, 3, false, esriCommandStyles.esriCommandStyleIconAndText);//识别工具mapPopMenu.AddItem(new ControlsMapZoomInFixedCommand(), -1, 4, false, esriCommandStyles.esriCommandStyleIconAndText);//mapPopMenu.AddItem(new ControlsMapZoomInFixedCommand(), -1, 5, false, esriCommandStyles.esriCommandStyleIconAndText);mapPopMenu.AddItem(new ControlsSelectFeaturesTool(), -1, 6, false, esriCommandStyles.esriCommandStyleIconAndText);//选择要素工具mapPopMenu.AddItem(new ControlsClearSelectionCommand(), -1, 7, false, esriCommandStyles.esriCommandStyleIconAndText);//缩放所选要素mapPopMenu.AddItem(new ControlsZoomToSelectedCommand(), -1, 8, false, esriCommandStyles.esriCommandStyleIconAndText);mapPopMenu.AddItem(new ControlsMapZoomToLastExtentBackCommand(), -1, 9, false, esriCommandStyles.esriCommandStyleIconAndText);mapPopMenu.AddItem(new ControlsMapZoomToLastExtentForwardCommand(), -1, 10, false, esriCommandStyles.esriCommandStyleIconAndText);mapPopMenu.SetHook(axMapControl1); 得到地图视窗右键菜单mapPopMenu.PopupMenu(e.x, e.y, axMapControl1.hWnd);//弹出显示菜单}/*  if (e.button == 1)//左键因为右键要取消{IMap pMap = axMapControl1.Map;IActiveView pActiveView = pMap as IActiveView;IEnvelope pEnv = axMapControl1.TrackRectangle();pActiveView.Extent = pEnv;pActiveView.Refresh();}* *///此事件不会触发if (e.button == 3)//如果鼠标中间改为ControlsMapPanTool会更好{IMap pMap = axMapControl1.Map;IActiveView pActiveView = pMap as IActiveView;IEnvelope pEnv = axMapControl1.TrackRectangle();pActiveView.Extent = pEnv;pActiveView.Refresh();}}

ArcGIS Engine 中实现右键出现快捷键菜单栏相关推荐

  1. ArcGIS Engine中的Symbols详解

    转自原文 ArcGIS Engine中的Symbols详解 本文由本人翻译ESRI官方帮助文档.尊重劳动成果,转载请注明来源. Symbols ArcObjects用了三种类型的Symbol(符号样式 ...

  2. ArcGIS Engine中空间参照(地理坐标)相关方法总结

    转自原文 ArcGIS Engine中空间参照(地理坐标)相关方法总结 1.创建空间参考 /// <summary> /// 根据prj文件创建空间参考 /// </summary& ...

  3. ArcGIS Engine中的8种数据访问【转】

    原文地址没找到... 据是GIS的基础, 访问数据也是进行任何复杂的空间分析及空间可视化表达的前提.ArcGIS支持的数据格式比较丰富,对不同的数据格式支持的程度也有很大差异.本文主要介绍一下以下八种 ...

  4. ArcGIS Engine 中的多线程使用

    转自原文ArcGIS Engine 中的多线程使用 一直都想写写AE中多线程的使用,但一直苦于没有时间,终于在中秋假期闲了下来.呵呵,闲话不说了,进入正题! 大家都了解到ArcGIS中处理大数据量时速 ...

  5. 【错误异常大全】:ArcGIS Engine中C#无法引用ESRI.ArcGIS.AxControls问题

    ArcGIS Engine中C#无法引用ESRI.ArcGIS.AxControls问题,具体如下. 发现在引用列表中找不到ESRI.ArcGIS.AxControls服务. 一直显示感叹号. 多次尝 ...

  6. ArcGIS Engine中删除要素的几种方法总结

    转自原文 ArcGIS Engine中删除要素的几种方法总结 [csharp] view plain copy print? /// <summary> /// 通过IFeature.De ...

  7. ArcGIS Engine中如何获取Map中已经选择的要素呢(转)

    ArcGIS Engine中如何获取Map中已经选择的要素呢   1.使用IEnumFeturea对象获取map中的FeatureSelection,该方法可以获取所有图层的选择要素.IMap中的Fe ...

  8. ArcGIS engine中Display类库 (局部刷新)

    转自原文 ArcGIS engine中Display类库 (局部刷新) Display类库包括了用于显示GIS数据的对象.除了负责实际输出图像的主要显示对象(display object)外,这个类库 ...

  9. Arcgis Engine中检索 COM 类工厂中 CLSID 为{*} 的组件失败,原因是出现以下错误: 80040111 的解决方法

    最近在学习Arcgis Engine开发时,创建实例时经常会出现下列错误 网上搜索到的解决办法有两种: 1.操作系统版本问题 如果是在Win7 64版本下,可能出现该问题,需要将把配置管理器里的运行平 ...

最新文章

  1. 160个Crackme023
  2. Mysql京东的一道面试题目 比较综合
  3. view技术简单了解
  4. Day-6:创建计算字段
  5. Jsonschema2pojo从JSON生成Java类(Maven)
  6. php 初始化model,TP5 model类研究
  7. Android TelephonyManager类
  8. mybatis-plus自定义sql分页
  9. 一阶系统开环传递函数表达式_第四讲 控制系统的方框图
  10. 《TCP/IP详解 卷1:协议》PDF分享
  11. 单片机中,intrins.h头文件中各函数详解:空指令_nop_(),移位函数_crol_、_cror_
  12. SSM整合-内涵基本SSM开发基本结构框架
  13. IMAX Enhanced:让沉浸式家庭影音娱乐体验不再抽象
  14. 《富兰克林自传》读后感:从这个接地气的伟人身上我们可以学到什么?
  15. SpringCloud Gateway详解与配置
  16. inet aton在java_地址转换函数:inet_aton inet_ntoa inet_addr和inet_pton inet_ntop
  17. SpringBoot的学习资源 尚硅谷 蚂蚁学院
  18. Harris角点两篇比较好的文章
  19. nginx正向代理的配置及实现
  20. android自动弹出浏览器打开文件,android使用主流浏览器打开网页,无需弹出选择。...

热门文章

  1. java发送邮件设置邮件头的MessageId解决办法,发送邮件代码,u-mail的示例代码
  2. Apache Sqoop Job :案例练习
  3. openlayers根据坐标定位_CAD中坐标系的巧妙应用你会吗?
  4. GNU Radio 社区
  5. 计算机维修工中级在线阅读,计算机维修工中级资格考试笔试试题(B卷)
  6. 做个精明的消费者 购买笔记本该有的不能少
  7. 100m光纤测速多少正常_我家装的100M宽带,测速只有92M,正常吗
  8. Linux应用开发之延时操作
  9. 品优购04——商家入驻审核
  10. javascript实现增删改查