RichTextBox.Redo 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
重新套用控制中被撤銷的最後操作。
public:
void Redo();
public void Redo();
member this.Redo : unit -> unit
Public Sub Redo ()
範例
以下程式碼範例示範如何使用 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
備註
接著你可以用這個 Redo 方法重新套用上次的復原操作到控制項上。 此 CanRedo 方法可判斷使用者先前還原的操作是否能重新套用到控制器上。