Undo / Redo in Windows Forms Diagram

27 Apr 20211 minute to read

The actions can be recorded into the history manager such that the undo and redo operations can be performed. The recording can be controlled and the undo and redo actions can be performed using the following tools.

Undo / Redo Properties

History Manager Tool Description
Undo Undo the previous action.
Redo Redo the previous action. Redo action can be performed only after an undo action.
StartAtomicAction Stops recording the actions and hence will not be added to the undo history manager.
EndAtomicAction Cancels the StartAtomicAction process and turns on the recording of actions in the history manager.

Programmatically, it is implemented as follows:

this.diagram1.Model.HistoryManager.StartAtomicAction("Custom Action");
Me.diagram1.Model.HistoryManager.StartAtomicAction("Custom Action")