次の方法で共有


RichTextBox.CanRedo プロパティ

RichTextBox 内で実行されたアクションのうち再適用できるアクションがあるかどうかを示す値を取得します。

Public ReadOnly Property CanRedo As Boolean
[C#]
public bool CanRedo {get;}
[C++]
public: __property bool get_CanRedo();
[JScript]
public function get CanRedo() : Boolean;

プロパティ値

元に戻された操作のうち、コントロールの内容に再適用できる操作がある場合は true 。それ以外の場合は false

解説

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

使用例

[Visual Basic, C#, C++] CanRedo プロパティと RedoActionName プロパティ、および Redo メソッドを使用し、テキストの削除以外の操作に対するやり直し操作を禁止する方法を次の例に示します。この例は、フォームに RichTextBox コントロールが含まれていて、この例のコードが呼び出される前に RichTextBox 内で何らかの操作が実行され、その操作が元に戻されていることを前提にしています。

 
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

[C#] 
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();
    }
}

[C++] 
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(S"Delete"))
                // Perform the redo.
                richTextBox1->Redo();
        }
    }

[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ

参照

RichTextBox クラス | RichTextBox メンバ | System.Windows.Forms 名前空間 | Redo