使用撤消和重做功能

执行撤消和重做操作

以下 API 可用于该任务。每个API都给出了描述,请检查它们。

  • GridDesktop.EnableUndo - 属性:表示是否启用Undo功能,默认值为“false”。
  • 撤销管理器– class:用于管理undo/redo操作。
  • GridDesktop.UndoManager – 属性:它获取的实例撤销管理器目的。
  • UndoManager.Undo – 方法:它执行撤销操作。
  • **UndoManager.Redo -**方法:它执行重做操作。
  • UndoManager.ClearStack – 方法:清除撤消/重做堆栈。
  • UndoManager.UndoStepsCount – 属性:它获取当前可用的撤消步骤的计数。
  • UndoManager.RedoStepsCount – 属性:它获取当前可用重做步骤的计数。
  • UndoManager.UndoStackSize – 属性:它获取/设置撤消堆栈大小。

撤消

下面的示例代码展示了如何使用 GridDesktop API 实现撤消操作。

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// Enable the Undo operation
gridDesktop1.EnableUndo = true;
// Create the UndoManager object
UndoManager um = gridDesktop1.UndoManager;
// Perform Undo operation
um.Undo();

重做

下面的示例代码展示了如何使用 GridDesktop API 实现 Redo 操作。

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// Create the UndoManager object
UndoManager um = gridDesktop1.UndoManager;
// Perform Redo operation
um.Redo();