可以把AE自带的重做、撤销按钮或工具添加到axToolBarControl上,再把axToolBarControl工具条隐藏,同时,在自定义的工具条上新建对应的按钮,按下此按钮实际触发的是AE自带的按钮功能!如在基础平台上的撤销!
//开始定义工具条 IOperationStack operationStack = new ControlsOperationStackClass(); axUndoRedoToolbar.OperationStack = operationStack; axUndoRedoToolbar.SetBuddyControl(mainMapControl.Object); axUndoRedoToolbar.Hide(); //撤销 private void tlBtnUndo_Click(object sender, EventArgs e) { IOperationStack operationStack = axUndoRedoToolbar.OperationStack; //Do the following to undo the previous operation on the stack. try { if (operationStack.UndoOperation != null) { operationStack.Undo();//调用AE自带重做指令 } else { MessageBox.Show("没有可撤消的操作!"); } } catch (Exception ex) { MessageBox.Show(ex.ToString(), "无可撤消操作"); } } //重做 private void tlBtnRedo_Click(object sender, EventArgs e) { IOperationStack operationStack = axUndoRedoToolbar.OperationStack; try { if (operationStack.RedoOperation == null) { MessageBox.Show("没有可重做的操作!"); } else { operationStack.Redo(); } } catch (Exception ex) { MessageBox.Show(ex.ToString(), "无可重做操作"); } }
最新评论