←Select platform

Undo Method

Summary
Reverses the last operation performed in this AnnAutomation.
Syntax
C#
Objective-C
C++/CLI
Java
Python
public virtual void Undo() 
- (void)undo; 
public void undo() 
public:  
   virtual void Undo() 
def Undo(self): 
Remarks

If the CanUndo property returns true, this method will undo the last operation performed in this AnnAutomation.

Use the UndoCapacity property to get or set the number of user actions that can be reversed using the Undo method, or reapplied using the Redo method. The default for the UndoCapacity property is 10 actions.

For information on undoing or redoing automation operations, refer to Undoing Annotation Automation Operations.

Example
C#
using Leadtools.Annotations.Automation; 
 
using Leadtools.Annotations.Engine; 
using Leadtools.Codecs; 
using Leadtools.Controls; 
using Leadtools.Annotations.Rendering; 
using Leadtools.Annotations.WinForms; 
 
public void AnnAutomation_BeginUndo() 
{ 
   // first create a new undo node 
   _automation.BeginUndo(); 
 
   try 
   { 
      // add a new rectangle object 
      AnnRectangleObject rectObj = new AnnRectangleObject(); 
      rectObj.Rect = LeadRectD.Create(100, 100, 800, 800); 
      rectObj.Stroke = AnnStroke.Create(AnnSolidColorBrush.Create("Blue"), LeadLengthD.Create(1)); 
      rectObj.Fill = AnnSolidColorBrush.Create("Yellow"); 
      _automation.Container.Children.Add(rectObj); 
 
      // Invalidate it 
      _automation.Invalidate(LeadRectD.Empty); 
 
      // Select this object 
      _automation.SelectObject(rectObj); 
 
      // commit the undo node 
      _automation.EndUndo(); 
   } 
   catch (Exception ex) 
   { 
      // in case of errors, cancel the undo node 
      _automation.CancelUndo(); 
      Debug.WriteLine(ex.Message); 
      return; 
   } 
 
   Debug.WriteLine("Object has been added as is now selected. Next will call //Undo// to undo the operation"); 
   _automation.Undo(); 
   Debug.WriteLine("Operation has been undone. Next will call //Redo// to redo the operation"); 
   _automation.Redo(); 
   Debug.WriteLine("Object should be back and selected"); 
} 
Requirements

Target Platforms

Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Annotations.Automation Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.