다음을 통해 공유


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

멤버

  멤버 이름 설명
PlainText OLE(개체 링크와 포함) 개체 대신 공백을 표시하는 일반 텍스트 스트림입니다. 
RichNoOleObjs OLE 개체 대신 공백을 표시하는 RTF(서식 있는 텍스트) 스트림입니다. 이 값은 RichTextBox 컨트롤의 SaveFile 메서드와 함께 사용하는 경우에만 유효합니다. 
RichText RTF(서식 있는 텍스트) 스트림입니다. 
TextTextOleObjs OLE 개체의 텍스트 표시를 포함하는 일반 텍스트 스트림입니다. 이 값은 RichTextBox 컨트롤의 SaveFile 메서드와 함께 사용하는 경우에만 유효합니다. 
UnicodePlainText OLE(Object Linking and Embedding) 개체 대신 공백을 포함하는 텍스트 스트림입니다. 텍스트는 유니코드로 인코딩되어 있습니다. 

설명

RichTextBox 컨트롤의 LoadFileSaveFile 메서드를 호출할 때 이 열거형의 멤버를 사용합니다.

예제

다음 예제에서는 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에서 모든 플래폼의 모든 버전을 지원하지는 않습니다. 지원되는 버전의 목록은 시스템 요구 사항을 참조하십시오.

버전 정보

.NET Framework

2.0, 1.1, 1.0에서 지원

참고 항목

참조

System.Windows.Forms 네임스페이스
RichTextBox 클래스
LoadFile
SaveFile