zoukankan      html  css  js  c++  java
  • 在MapControl控件中右击事件添加系统自带的命令

     private IToolbarMenu m_menuMap = null;//全局变量

     private IMapControl3 m_mapControl = null;

    主窗体Load事件中加入:

    m_mapControl = (IMapControl3)this.axMapControl1.Object;
    m_menuMap = new ToolbarMenuClass();

    //ICommand命令

    m_menuMap.AddItem( new ControlsMapFullExtentCommand(), -1, 0, false, esriCommandStyles.esriCommandStyleIconAndText);
    m_menuMap.AddItem(new ControlsMapPanTool(), -1, 1, false, esriCommandStyles.esriCommandStyleIconAndText);
    m_menuMap.AddItem(new ControlsMapZoomInTool(), -1, 2, false, esriCommandStyles.esriCommandStyleIconAndText);
    m_menuMap.AddItem(new ControlsMapZoomOutTool(), -1, 3, false, esriCommandStyles.esriCommandStyleIconAndText);
    m_menuMap.AddItem(new ControlsAddDataCommandClass(), -1, 4, false, esriCommandStyles.esriCommandStyleIconAndText);

    m_menuMap.SetHook(m_mapControl);//很重要

    private void axMapControl1_OnMouseDown(object sender, ESRI.ArcGIS.Controls.IMapControlEvents2_OnMouseDownEvent e)
    {
    if (e.button == 2)
    {
    //弹出右键菜单
    m_menuMap.PopupMenu(e.x, e.y, m_mapControl.hWnd);
    }

    }


    作者:jinqier
    出处:http://www.cnblogs.com/jinqier/
    本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。

  • 相关阅读:
    Python 缓冲区
    Python接收执行参数
    Python编码
    Maven 多环境 打包
    JS 时间 获取 当天,昨日,本周,上周,本月,上月
    Window Mysql 5.7.18安装
    Eclipse 更改Maven项目名
    Redis 命令
    Redis 安装 和 启动
    Mongodb 安装 和 启动
  • 原文地址:https://www.cnblogs.com/jinqier/p/2527155.html
Copyright © 2011-2022 走看看