RichTextBoxStreamType 列挙体
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)

Public Enumeration RichTextBoxStreamType

メンバ名 | 説明 | |
---|---|---|
PlainText | OLE (Object Linking and Embedding) オブジェクトの代わりに空白が含まれているプレーン テキスト ストリーム。 | |
RichNoOleObjs | OLE オブジェクトの代わりの空白を持つリッチ テキスト形式 (RTF: Rich Text Format) のストリーム。この値は、RichTextBox コントロールの SaveFile メソッドを使用する場合に限り有効です。 | |
RichText | リッチ テキスト形式 (RTF) ストリーム。 | |
TextTextOleObjs | OLE オブジェクトのテキスト表現を持つプレーン テキスト ストリーム。この値は、RichTextBox コントロールの SaveFile メソッドを使用する場合に限り有効です。 | |
UnicodePlainText | OLE オブジェクトの代わりに空白が含まれているテキスト ストリーム。テキストは Unicode でエンコードされています。 |


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

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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- RichTextBoxStreamType 列挙体のページへのリンク