RichTextBox.CanRedo 屬性

定義

取得值,指出是否有可以再套用的動作發生於 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

屬性值

Boolean

如果有已復原而可以再套用於控制項內容的作業,則為 true,否則為 false

屬性

範例

下列程式碼範例示範如何使用 CanRedoRedoActionName 屬性和 Redo 方法,將重做作業限制為刪除文字以外的任何動作。 此範例要求您有一個表單,其中包含 RichTextBox 控制項,而且 在呼叫此範例中的程式碼之前,已執行並復原 中的 RichTextBox 作業。

private:
   void RedoAllButDeletes()
   {
      // Determines if a Redo operation can be performed.
      if ( richTextBox1->CanRedo == true )
      {
         // 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 == true)
    {
        // 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

適用於

另請參閱