首页 > 代码库 > IEngineEditor与IWorkspaceEdit,以及相关的事件监听
IEngineEditor与IWorkspaceEdit,以及相关的事件监听
转自原文 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,以及相关的事件监听
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。