Table of contents
TOC
折叠目录
展开目录

InvisibleApp.Redo 方法 (Visio)InvisibleApp.Redo Method (Visio)

office 365 dev account|上次更新日期: 2018/3/13
|
2 参与人员

取消最近的撤消单元。Reverses the most recent undo unit.

语法Syntax

表达式重做expression . Redo

表达式_一个表示InvisibleApp对象的变量。_expression A variable that represents an InvisibleApp object.

返回值Return Value

nothingnothing

注解Remarks

若要反转Undo方法的效果,请使用Redo方法。例如,如果您清除某项,然后使用Undo方法来还原该使用Redo方法将再次清除该项目。To reverse the effect of the Undo method, use the Redo method. For example, if you clear an item and then use the Undo method to restore it, use the Redo method to clear the item again.

不能调用Redo方法从在打开的撤消单元范围内执行的代码。如果是下列情况之一,代码是在打开的撤消单元范围中:You cannot invoke the Redo method from code that is executing inside the scope of an open undo unit. Code is in the scope of an open undo unit if it is one of the following:

  • 由 Microsoft Visio 用户界面调用宏或加载项。A macro or add-on invoked by the Microsoft Visio user interface.

  • 在对VisioIsIdle事件以外的 Visio 事件进行响应的事件处理程序。In an event handler responding to a Visio event other than the VisioIsIdle event.

  • 在用户创建的撤消范围中。如果从打开的撤消单元范围内的代码调用Redo方法,将引发异常。In a user-created undo scope. If you call the Redo method from code inside the scope of an open undo unit, it will raise an exception.

如果 Visio 实例当前正在执行撤消或重做, Redo方法还将引发异常。若要确定是否 Visio 实例撤消或重做使用IsUndoingOrRedoing属性。The Redo method also raises an exception if the Visio instance is presently performing an undo or redo. To determine whether the Visio instance is undoing or redoing use the IsUndoingOrRedoing property.

因为当IsUndoingOrRedoing属性设为False ,只会激发VisioIsIdle事件的情况下,可以从VisioIsIdle事件处理程序调用Redo方法。您也可以从代码不调用 Visio 实例,例如,在 Visual Basic 编辑器中或从外部程序调用的代码调用Redo方法。You can call the Redo method from the VisioIsIdle event handler because the VisioIsIdle event can only fire when the IsUndoingOrRedoing property is False . You can also call the Redo method from code not invoked by the Visio instance, for example, code invoked from the Visual Basic Editor or from an external program.

示例Example

以下 Microsoft Visual Basic for Applications (VBA) 宏显示如何撤消和恢复动作。This Microsoft Visual Basic for Applications (VBA) macro shows how to undo and redo actions.


Public Sub Redo_Example() 

 Dim vsoShape As Visio.Shape 

 'Draw a rectangle, use Undo to delete it, and 
 'then use Redo to redraw it. 
 Set vsoShape = ActivePage.DrawRectangle(1, 5, 5, 1) 

 'Delete the shape. 
 Visio.Application.Undo 

 'Bring it back. 
 Visio.Application.Redo 

End Sub
© 2018 Microsoft