TextBoxBase.Undo 方法

定義

復原最近一次的復原指令。 換句話說,將復原堆疊上的最新復原單位復原。

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

傳回

Boolean

如果復原作業成功,則為 true,否則為 false。 如果復原堆疊為空白,此方法會傳回 false

範例

下列範例示範如何使用 Undo 方法。

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

適用於

另請參閱