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

属性

次のコード例では、プロパティとRedoActionNameメソッドをCanRedo使用して、やり直し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

注釈

このプロパティを使用すると、メソッドを使用してRedo、最後に元に戻した操作をRichTextBox再適用できるかどうかを判断できます。

適用対象

こちらもご覧ください