RichTextBox.CanRedo 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
獲得一個值,表示是否已發生 RichTextBox 可重複套用的動作。
public:
property bool CanRedo { bool get(); };
[System.ComponentModel.Browsable(false)]
public bool CanRedo { get; }
[<System.ComponentModel.Browsable(false)>]
member this.CanRedo : bool
Public ReadOnly Property CanRedo As Boolean
屬性值
true若有操作被撤銷,可重新套用於控制內容;否則,。 false
- 屬性
範例
以下程式碼範例示範如何使用 CanRedo and RedoActionName 屬性及方法 Redo ,限制重做操作只能執行除刪除文字外的任何動作。 這個範例要求你有一個包含 RichTextBox 控制項的表單,並且在程式碼被呼叫前,必須在 中 RichTextBox 執行並還原某個操作。
private:
void RedoAllButDeletes()
{
// Determines if a Redo operation can be performed.
if ( richTextBox1->CanRedo )
{
// Determines if the redo operation deletes text.
if ( !richTextBox1->RedoActionName->Equals( "Delete" ) )
// Perform the redo.
richTextBox1->Redo();
}
}
private void RedoAllButDeletes()
{
// Determines if a Redo operation can be performed.
if (richTextBox1.CanRedo)
{
// Determines if the redo operation deletes text.
if (richTextBox1.RedoActionName != "Delete")
// Perform the redo.
richTextBox1.Redo();
}
}
Private Sub RedoAllButDeletes()
' Determines if a Redo operation can be performed.
If richTextBox1.CanRedo = True Then
' Determines if the redo operation deletes text.
If richTextBox1.RedoActionName <> "Delete" Then
' Perform the redo.
richTextBox1.Redo()
End If
End If
End Sub
備註
你可以利用這個特性判斷 中 RichTextBox 最後一次被撤銷的操作是否能用該 Redo 方法重新套用。