码迷,mamicode.com
首页 > 其他好文 > 详细

IEngineEditor与IWorkspaceEdit,以及相关的事件监听

时间:2017-01-08 19:14:16      阅读:160      评论:0      收藏:0      [点我收藏+]

标签:map   sdn   menu   edit   nbsp   sed   work   代码   imap   

转自原文 IEngineEditor与IWorkspaceEdit,以及相关的事件监听

IEngineEditor适用于直接在图层上的编辑,例如使用“要素编辑”工具菜单上的“开始编辑”等工具进行编辑,相应的事件使用IWorkspaceEdit监听,例如以下的代码:

private IEngineEditor m_EngineEditor = new EngineEditorClass();  
private IEngineEditEvents_Event m_EngineEditEvents ;  
private void MainForm_Load(object sender,EventArgs e)  
{  
     //get the MapControl  
     m_mapControl = (IMapControl3)axMapControl1.Object;  
     //disable the Save menu (since there is no document yet)  
     menuSaveDoc.Enabled = false;  
     m_EngineEditEvents = (IEngineEditEvents_Event)m_EngineEditor;  
     m_EngineEditEvents.OnStartEditing += new IEngineEditEvents_OnStartEditingEventHandler(m_EngineEditEvents_OnStartEditing);  
}  
void m_EngineEditEvents_OnStartEditing()  
{  
     MessageBox.Show("Start Editing");       
}   

IWorkspaceEdit适用于直接对workspace进行的编辑,相应的事件使用IWorkspaceEditEvents_Event监听,例如以下的代码:

private IWorkspaceEdit wsEdit;  
private IWorkspaceEditEvents_Event wsEditEvents;  
private void MainForm_Load(object sender,EventArgs e)  
{  
      //get the MapControl  
      m_mapControl = (IMapControl3)axMapControl1.Object;  
      //disable the Save menu (since there is no document yet)  
       menuSaveDoc.Enabled = false;  
      wsEdit = MyTool.GetWorkspaceEdit(map1.Map);  
      wsEditEvents = (IWorkspaceEditEvents_Event)wsEdit;  
      wsEditEvents.OnStopEditing += new IWorkspaceEditEvents_OnStopEditingEventHandler(wsEditEvents_OnStopEditing);  
}  
void wsEditEvents_OnStopEditing(bool saveEdits)  
{  
      MessageBox.Show("StopEditing");  
}  

 

IEngineEditor与IWorkspaceEdit,以及相关的事件监听

标签:map   sdn   menu   edit   nbsp   sed   work   代码   imap   

原文地址:http://www.cnblogs.com/arxive/p/6262456.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!