Creates a new undo node in this AnnAutomation object.
public virtual void BeginUndo() Public Overridable Sub BeginUndo()
public:virtual void BeginUndo();
Use this method along with the EndUndo and CancelUndo methods to programmatically add a node to the undo stack maintained by this AnnAutomation. Typically, you add an undo node as follows:
You do not need to manually call the BeginUndo, EndUndo or CancelUndo methods when calling methods from this AnnAutomation object directly. The AnnAutomation object will internally do this for you. For example, when you call the Delete method to delete the object(s) currently being edited, the AnnAutomation object will perform the above sequence internally to add the undo node.
Use the UndoCapacity property to get or set the number of user actions that can be reversed using the Undo method, or re-applied using the Redo method. The default for the UndoCapacity property is 10 actions.
For more information, refer to Undoing WPF Automation Operations.
This example will manually add a new rectangle object to an automation object and then start editing it.
using Leadtools.Windows.Controls;using Leadtools.Windows.Annotations;using Leadtools.Demos;using Leadtools.Help;private void AnnAutomation_BeginUndo(AnnAutomation automation){// first create a new undo nodeautomation.BeginUndo();try{// add a new rectangle objectAnnRectangleObject rectObj = new AnnRectangleObject();rectObj.Rect = new Rect(100, 100, 200, 200);rectObj.Stroke = Colors.Blue;rectObj.Fill = Colors.Yellow;rectObj.StrokeThickness = 2.0;automation.Container.Children.Add(rectObj);// "select" this objectautomation.StartEditing(rectObj, false);// commit the undo nodeautomation.EndUndo();}catch (Exception ex){// in case of errors, cancel the undo nodeautomation.CancelUndo();throw ex;}MessageBox.Show("Object has been added as is now selected. Next will call //Undo// to undo the operation");automation.Undo();MessageBox.Show("Operation has been undone. Next will call //Redo// to redo the operation");automation.Redo();MessageBox.Show("Object should be back and selected");}
Imports Leadtools.Windows.ControlsImports Leadtools.Windows.AnnotationsPrivate Sub AnnAutomation_BeginUndo(ByVal automation As AnnAutomation)' first create a new undo nodeautomation.BeginUndo()Try' add a new rectangle objectDim rectObj As AnnRectangleObject = New AnnRectangleObject()rectObj.Rect = New Rect(100, 100, 200, 200)rectObj.Stroke = Colors.BluerectObj.StrokeThickness = 2.0rectObj.Fill = Colors.Yellowautomation.Container.Children.Add(rectObj)' "select" this objectautomation.StartEditing(rectObj, False)' commit the undo nodeautomation.EndUndo()Catch ex As Exception' in case of errors, cancel the undo nodeautomation.CancelUndo()Throw exEnd TryMessageBox.Show("Object has been added as is now selected. Next will call //Undo// to undo the operation")automation.Undo()MessageBox.Show("Operation has been undone. Next will call //Redo// to redo the operation")automation.Redo()MessageBox.Show("Object should be back and selected")End Sub
using Leadtools.Windows.Controls;using Leadtools.Windows.Annotations;using Leadtools.Examples;using Leadtools.Silverlight.Demos;//using Leadtools.Help;private void AnnAutomation_BeginUndo(AnnAutomation automation){// first create a new undo nodeautomation.BeginUndo();try{// add a new rectangle objectAnnRectangleObject rectObj = new AnnRectangleObject();rectObj.Rect = new Rect(100, 100, 200, 200);rectObj.Stroke = Colors.Blue;rectObj.Fill = Colors.Yellow;rectObj.StrokeThickness = 2.0;automation.Container.Children.Add(rectObj);// "select" this objectautomation.StartEditing(rectObj, false);// commit the undo nodeautomation.EndUndo();}catch (Exception ex){// in case of errors, cancel the undo nodeautomation.CancelUndo();throw ex;}MessageBox.Show("Object has been added as is now selected. Next will call //Undo// to undo the operation");automation.Undo();MessageBox.Show("Operation has been undone. Next will call //Redo// to redo the operation");automation.Redo();MessageBox.Show("Object should be back and selected");}
Imports Leadtools.Windows.ControlsImports Leadtools.Windows.AnnotationsImports Leadtools.Silverlight.Demos'using Leadtools.Help;Private Sub AnnAutomation_BeginUndo(ByVal automation As AnnAutomation)' first create a new undo nodeautomation.BeginUndo()Try' add a new rectangle objectDim rectObj As AnnRectangleObject = New AnnRectangleObject()rectObj.Rect = New Rect(100, 100, 200, 200)rectObj.Stroke = Colors.BluerectObj.Fill = Colors.YellowrectObj.StrokeThickness = 2.0automation.Container.Children.Add(rectObj)' "select" this objectautomation.StartEditing(rectObj, False)' commit the undo nodeautomation.EndUndo()Catch ex As Exception' in case of errors, cancel the undo nodeautomation.CancelUndo()Throw exEnd TryMessageBox.Show("Object has been added as is now selected. Next will call //Undo// to undo the operation")automation.Undo()MessageBox.Show("Operation has been undone. Next will call //Redo// to redo the operation")automation.Redo()MessageBox.Show("Object should be back and selected")End Sub
Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET
