次の方法で共有


RichTextBox.Redo メソッド

コントロールで最後に元に戻された操作を再適用します。

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)

構文

'宣言
Public Sub Redo
'使用
Dim instance As RichTextBox

instance.Redo
public void Redo ()
public:
void Redo ()
public void Redo ()
public function Redo ()

解説

Redo メソッドを使用して、最後に元に戻した操作をコントロールに再適用できます。CanRedo メソッドを使用すると、ユーザーが最後に元に戻した操作をコントロールに再適用できるかどうかを確認できます。

使用例

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
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:
   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.get_CanRedo() == true) {
        // Determines if the redo operation deletes text.
        if (!(richTextBox1.get_RedoActionName().Equals("Delete"))) {
            // Perform the redo.
            richTextBox1.Redo();
        }
    }
} //RedoAllButDeletes

プラットフォーム

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。

バージョン情報

.NET Framework

サポート対象 : 2.0、1.1、1.0

参照

関連項目

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