RichTextBoxStreamType 列挙体とは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > RichTextBoxStreamType 列挙体の意味・解説 

RichTextBoxStreamType 列挙体

RichTextBox コントロールで、データの読み込みおよび保存に使用される入出力ストリームの型を指定します。

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

Public Enumeration RichTextBoxStreamType
Dim instance As RichTextBoxStreamType
public enum RichTextBoxStreamType
public enum class RichTextBoxStreamType
public enum RichTextBoxStreamType
public enum RichTextBoxStreamType
メンバメンバ
解説解説

この列挙体のメンバは、RichTextBox コントロールの LoadFile メソッドおよび SaveFile メソッドを呼び出すときに使用します。

使用例使用例

RichTextBox の内容を ASCII テキスト ファイルに保存する例を次に示します。この例は、SaveFileDialog クラスを使用して、ファイルのパスと名前を指定するようにユーザーに要求するダイアログ ボックスを表示します。次に、コントロールの内容をユーザーが指定したファイルに保存します。この例では、このバージョンの SaveFile メソッドを使用し、ファイルを標準の RTF ファイルではなく ASCII テキスト ファイルとして保存するように指定しています。この例は、コードが richTextBox1 という名前の RichTextBox コントロールを保持する Form クラス内にあることを前提にしています。

Public Sub SaveMyFile()
    ' Create a SaveFileDialog to request a path and file name to save
 to.
    Dim saveFile1 As New
 SaveFileDialog()
    
    ' Initialize the SaveFileDialog to specify the RTF extension for
 the file.
    saveFile1.DefaultExt = "*.rtf"
    saveFile1.Filter = "RTF Files|*.rtf"
    
    ' Determine if the user selected a file name from the saveFileDialog.
    If (saveFile1.ShowDialog() = System.Windows.Forms.DialogResult.OK)
 _
        And (saveFile1.FileName.Length) > 0 Then
    
        ' Save the contents of the RichTextBox into the file.
        richTextBox1.SaveFile(saveFile1.FileName, _
            RichTextBoxStreamType.PlainText)
    End If
End Sub

public void SaveMyFile()
{
   // Create a SaveFileDialog to request a path and file name to save
 to.
   SaveFileDialog saveFile1 = new SaveFileDialog();

   // Initialize the SaveFileDialog to specify the RTF extension for
 the file.
   saveFile1.DefaultExt = "*.rtf";
   saveFile1.Filter = "RTF Files|*.rtf";

   // Determine if the user selected a file name from the saveFileDialog.
   if(saveFile1.ShowDialog() == System.Windows.Forms.DialogResult.OK
 &&
      saveFile1.FileName.Length > 0) 
   {
      // Save the contents of the RichTextBox into the file.
      richTextBox1.SaveFile(saveFile1.FileName, RichTextBoxStreamType.PlainText);
   }
}

public:
   void SaveMyFile()
   {
      // Create a SaveFileDialog to request a path and file name to save
 to.
      SaveFileDialog^ saveFile1 = gcnew SaveFileDialog;
      
      // Initialize the SaveFileDialog to specify the RTF extension for
 the file.
      saveFile1->DefaultExt = "*.rtf";
      saveFile1->Filter = "RTF Files|*.rtf";
      
      // Determine if the user selected a file name from the saveFileDialog.
      if ( saveFile1->ShowDialog() == System::Windows::Forms::DialogResult::OK
 &&
         saveFile1->FileName->Length > 0 )
      {
         // Save the contents of the RichTextBox into the file.
         richTextBox1->SaveFile( saveFile1->FileName, RichTextBoxStreamType::PlainText
 );
      }
   }
public void SaveMyFile()
{
    // Create a SaveFileDialog to request a path and file name to save
 to.
    SaveFileDialog saveFile1 = new SaveFileDialog();

    // Initialize the SaveFileDialog to specify the RTF extension for
 the 
    // file.
    saveFile1.set_DefaultExt("*.rtf");
    saveFile1.set_Filter("RTF Files|*.rtf");

    // Determine if the user selected a file name from the saveFileDialog.
    if (saveFile1.ShowDialog() == 
        System.Windows.Forms.DialogResult.OK && 
        saveFile1.get_FileName().length() > 0) {
            // Save the contents of the RichTextBox into the file.
            richTextBox1.SaveFile(
                saveFile1.get_FileName(), RichTextBoxStreamType.PlainText);
    }
} //SaveMyFile
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳

英語⇒日本語日本語⇒英語

辞書ショートカット

すべての辞書の索引

「RichTextBoxStreamType 列挙体」の関連用語

RichTextBoxStreamType 列挙体のお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



RichTextBoxStreamType 列挙体のページの著作権

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2026 Microsoft.All rights reserved.

©2026 GRAS Group, Inc.RSS