• arcgis engine 监听element的添加、更新和删除事件(使用IGraphicsContainerEvents)


    IGraphicsContainerEvents Interface

    如何监听 element事件?
    如,当我们在Mapcontrol上添加、删除、更新了一个Element后,如何捕捉到这个事件?
       1,首先定义全局变量: IGraphicsContainerEvents_Event pGraphicsContainerEvent;
       2,在Form1_Load中给该变量赋值: pGraphicsContainerEvent = this.axMapControl1.ActiveView.FocusMap.BasicGraphicsLayer as IGraphicsContainerEvents_Event;
       3,添加事件处理
    pGraphicsContainerEvent.ElementAdded += new IGraphicsContainerEvents_ElementAddedEventHandler(ElementAddedMethod);
     
               pGraphicsContainerEvent.ElementDeleted +=new IGraphicsContainerEvents_ElementDeletedEventHandler(ElementDeletedMethod);
     
                pGraphicsContainerEvent.ElementUpdated += new IGraphicsContainerEvents_ElementUpdatedEventHandler( ElementUpdatedMethod);
    4,定义事件:
      private void ElementAddedMethod(IElement i)
            {
                System.Windows.Forms.MessageBox.Show("Element Added");
                axMapControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null);
            }
            private void ElementDeletedMethod(IElement i)
            {
                System.Windows.Forms.MessageBox.Show("Element Deleted");
                axMapControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null);
            }
            private void ElementUpdatedMethod(IElement i)
            {
                System.Windows.Forms.MessageBox.Show("Element Updated");
                axMapControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null);
            }
    http://blog.sina.com.cn/s/blog_90b91bf10100yks1.html
     
     
     
     
     AllPropertiesMethodsDescription
    Event AllElementsDeleted Occurs when all the elements are deleted.
    Event ElementAdded Occurs when the element is added.
    Event ElementDeleted Occurs when the element is deleted.
    Event ElementsAdded Occurs when the elements are added.
    Event ElementUpdated Occurs when the element is updated.

  • 相关阅读:
    词云图value传递数据不显示(已解决)
    中文分词并将结果存入数据库
    《浪潮之巅》阅读笔记(一)
    亿信BI——维度转换组件使用
    SyntaxError: NonUTF8 code starting with '\xef' in file(已解决)
    AJAX——POST请求
    Ajax前后端交互——后端接收前端页面变量
    Ajax——Get请求
    《浪潮之巅》阅读笔记(二)
    谷粒商城分布式基础(十)—— 商品服务API—新增商品 & 商品管理
  • 原文地址:https://www.cnblogs.com/gisoracle/p/15630708.html
Copyright © 2020-2023  润新知