TextBoxBase.Undo TextBoxBase.Undo TextBoxBase.Undo TextBoxBase.Undo Method

定义

撤消最新的撤消命令。Undoes the most recent undo command. 换句话说,撤消位于撤消堆栈上的最新撤消单元。In other words, undoes the most recent undo unit on the undo stack.

public:
 bool Undo();
public bool Undo ();
member this.Undo : unit -> bool
Public Function Undo () As Boolean

返回

如果撤消操作成功,则为 true,否则为 falsetrue if the undo operation was successful; otherwise, false. 如果撤消堆栈为空,则此方法返回 falseThis method returns false if the undo stack is empty.

示例

下面的示例演示如何使用 Undo 方法。The following example demonstrates how to use the Undo method.

private void undoAction(object sender, RoutedEventArgs e)
{
    if (myTextBox.CanUndo == true)
    {
        myTextBox.Undo();
    }
}
Private Sub undoAction(ByVal sender As Object, ByVal e As RoutedEventArgs)
    If myTextBox.CanUndo = True Then
        myTextBox.Undo()
    Else : Return
    End If
End Sub

适用于

另请参阅