转自原文 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"); }
没有整理与归纳的知识,一文不值!高度概括与梳理的知识,才是自己真正的知识与技能。 永远不要让自己的*、好奇、充满创造力的想法被现实的框架所束缚,让创造力*成长吧! 多花时间,关心他(她)人,正如别人所关心你的。理想的腾飞与实现,没有别人的支持与帮助,是万万不能的。
本文转自wenglabs博客园博客,原文链接:http://www.cnblogs.com/arxive/p/6262456.html,如需转载请自行联系原作者