zoukankan      html  css  js  c++  java
  • 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.


     
  • 相关阅读:
    2018-12-25-dot-net-double-数组转-float-数组
    2018-12-25-dot-net-double-数组转-float-数组
    2019-10-24-dotnet-列表-Linq-的-Take-用法
    2019-10-24-dotnet-列表-Linq-的-Take-用法
    2018-8-10-C#-代码占用的空间
    2018-8-10-C#-代码占用的空间
    2018-4-29-C#-金额转中文大写
    2018-4-29-C#-金额转中文大写
    Java实现 LeetCode 630 课程表 III(大小堆)
    Java实现洛谷 P1072 Hankson 的趣味题
  • 原文地址:https://www.cnblogs.com/jhlong/p/5394557.html
Copyright © 2011-2022 走看看