MapControl图层删除或添加触发监听事件

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了MapControl图层删除或添加触发监听事件相关的知识,希望对你有一定的参考价值。

 

监听MapControl中对于图层添加和删除的事件

 

IActiveViewEvents_Event m_MapActiveViewEvents = m_mapControl.Map as IActiveViewEvents_Event;

 

//添加图层事件

m_MapActiveViewEvents.ItemAdded += new IActiveViewEvents_ItemAddedEventHandler(m_MapActiveViewEvents_ItemAdded);

//删除图层事件

m_MapActiveViewEvents.ItemDeleted += new IActiveViewEvents_ItemDeletedEventHandler(m_MapActiveViewEvents_ItemDeleted);

 

//事件处理

void m_MapActiveViewEvents_ItemDeleted(object item)
{
  ILayer pLayer = item as ILayer;
  //...
}
void m_MapActiveViewEvents_ItemAdded(object item)
{
  ILayer pLayer = item as ILayer;
  //...
}

以上是关于MapControl图层删除或添加触发监听事件的主要内容,如果未能解决你的问题,请参考以下文章

ArcEngine GroupLayer监听图层改变

ExtJS 下拉框监听事件日期选择器监听事件实现动态给items添加删除数据

百度地图如何监听自定义绘制的直线图层的点击事件

OpenLayers创建一个新的Vector图层并添加覆盖物,并监听图层事件

任务调度开源框架Quartz动态添加修改和删除定时任务

mui.fire()触发自定义事件