Creates a new undo node in this
AnnAutomation object.
Syntax
Visual Basic (Declaration) | |
---|
Public Overridable Sub BeginUndo() |
Visual Basic (Usage) | Copy Code |
---|
Dim instance As AnnAutomation
instance.BeginUndo()
|
C# | |
---|
public virtual void BeginUndo() |
Managed Extensions for C++ | |
---|
public: virtual void BeginUndo(); |
C++/CLI | |
---|
public:
virtual void BeginUndo(); |
Example
This example will manually add a new rectangle object to an automation object and then start editing it.
Visual Basic | Copy Code |
---|
Public Sub AnnAutomation_BeginUndo(ByVal automation As AnnAutomation)
automation.BeginUndo()
Try
Dim rectObj As AnnRectangleObject = New AnnRectangleObject()
rectObj.Bounds = New AnnRectangle(100, 100, 200, 200, AnnUnit.Pixel)
rectObj.Pen = New AnnPen(Color.Blue, New AnnLength(1, AnnUnit.Pixel))
rectObj.Brush = New AnnSolidBrush(Color.Yellow)
automation.Container.Objects.Add(rectObj)
automation.StartEditing(rectObj, False)
automation.EndUndo()
Catch ex As Exception
automation.CancelUndo()
Throw ex
End Try
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")
End Sub |
C# | Copy Code |
---|
public void AnnAutomation_BeginUndo(AnnAutomation automation) { // first create a new undo node automation.BeginUndo(); try { // add a new rectangle object AnnRectangleObject rectObj = new AnnRectangleObject(); rectObj.Bounds = new AnnRectangle(100, 100, 200, 200, AnnUnit.Pixel); rectObj.Pen = new AnnPen(Color.Blue, new AnnLength(1, AnnUnit.Pixel)); rectObj.Brush = new AnnSolidBrush(Color.Yellow); automation.Container.Objects.Add(rectObj); // "select" this object automation.StartEditing(rectObj, false); // commit the undo node automation.EndUndo(); } catch(Exception ex) { // in case of errors, cancel the undo node automation.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"); } |
Remarks
Requirements
Target Platforms: Microsoft .NET Framework 2.0, Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
See Also