使用撤消和重做功能

执行撤消和重做操作

以下API用于此任务。每个API都附有描述,请查阅。

  • GridDesktop.EnableUndo - 属性: 它指示是否启用了撤消功能,默认值为"false"。
  • UndoManager – 类: 用于管理撤消/重做操作。
  • GridDesktop.UndoManager – 属性: 获取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实现重做操作。

// 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();