RichTextBox.Redo メソッド

定義

コントロールで元に戻された最後の操作を再び実行します。

public:
 void Redo();
public void Redo();
member this.Redo : unit -> unit
Public Sub Redo ()

次のコード例では、 CanRedo プロパティと 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 メソッドを使用すると、ユーザーが元に戻した最後の操作をコントロールに再適用できるかどうかを判断できます。

適用対象

こちらもご覧ください