欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

AE框架中MapControl图层增加和图层删除事件

程序员文章站 2022-06-12 16:48:41
...

MapControl图层增加和图层删除事件


1.获取框架时,首先绑定MapControl的OnMapReplaced事件

 ((IMapControlEvents2_Event)MapControl).OnMapReplaced += new IMapControlEvents2_OnMapReplacedEventHandler(OnMapReplaced);     

2.绑定图层增加和图层删除事件

 public void LoadLayerEvent(object item)
 {
  IActiveViewEvents_Event pActiveViewEvent = (IActiveViewEvents_Event)MapControl.ActiveView;
  pActiveViewEvent.ItemDeleted += new IActiveViewEvents_ItemDeletedEventHandler(ItemChanged);
  pActiveViewEvent.ItemAdded += new IActiveViewEvents_ItemAddedEventHandler(ItemChanged);
 }

3.具体操作

public void ItemChanged(object item)
{}