UseBeginUndo,EndUndoandCancelUndoto programmatically add a node to the undo stack maintained by this一个nnAutomation. Typically, you add an undo node as follows:
Call theBeginUndomethod before you make any changes to create a new node.
Perform any changes to the一个nnAutomationobject.
Call theEndUndomethod to commit this undo node into the undo stack of the一个nnAutomationobject.
In case of errors (typically in a catch statement), call theCancelUndomethod to remove the node and cancel the operation.
You do not need to manually callBeginUndo,EndUndoorCancelUndowhen calling methods from this一个nnAutomationobject. The一个nnAutomationobject will internally do this for you. For example, when you call theDeleteSelectedObjectsmethod to delete the object(s) currently being edited, the一个nnAutomationobject will perform the above sequence internally to add the undo node.
Use theUndoCapacityproperty to get or set the number of user actions that can be reversed using theUndomethod, or re-applied using theRedomethod. The default for theUndoCapacityproperty is 10 actions.
For information on undoing or redoing automation operations, refer toUndoing Annotation Automation Operations.
This example will manually add a new rectangle object to an automation object and then start editing it.