TextBoxBase.CanUndo 屬性

定義

取得值,這個值表示是否能夠復原最近一個動作。

public:
 property bool CanUndo { bool get(); };
public bool CanUndo { get; }
member this.CanUndo : bool
Public ReadOnly Property CanUndo As Boolean

屬性值

true 如果可以復原最近的動作,則為 ;否則為 false

此屬性沒有預設值。

範例

下列程式碼範例示範如何使用 CanUndo 屬性來判斷是否可以復原最新的動作。

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

適用於

另請參閱