视频图像处理系列索引 || Arcgis/Engine/Server开发索引 || Web Map Gis开发索引 || jquery表格组件 JQGrid索引
WPF MVVM模式开发实现简明教程索引 || ArcGIS Runtime WPF(.net C#)开发简明教程索引

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.


 
posted @ 2016-04-15 11:00  jhlong  阅读(678)  评论(0编辑  收藏  举报
海龙的博客 jhlong@cnblogs 版权所有© 转载请注明链接.有用请推荐一下
代码全部经过本人测试,但不保证复制粘贴就正常运行,更不保证能解决你的问题,请结合前后代码及描述理解后修改和使用