RichTextBoxStreamType 열거형

정의

RichTextBox 컨트롤로 데이터를 로드하고 저장하는 데 사용되는 입력 및 출력 스트림의 형식을 지정합니다.

public enum class RichTextBoxStreamType
public enum RichTextBoxStreamType
type RichTextBoxStreamType = 
Public Enum RichTextBoxStreamType
상속
RichTextBoxStreamType

필드

PlainText 1

OLE(개체 링크와 포함) 개체 대신 공백을 표시하는 일반 텍스트 스트림입니다.

RichNoOleObjs 2

OLE 개체 대신 공백을 표시하는 RTF(서식 있는 텍스트) 스트림입니다. 이 값은 SaveFile(String) 컨트롤의 RichTextBox 메서드와 함께 사용하는 경우에만 유효합니다.

RichText 0

RTF(서식 있는 텍스트) 스트림입니다.

TextTextOleObjs 3

OLE 개체의 텍스트 표시를 포함하는 일반 텍스트 스트림입니다. 이 값은 SaveFile(String) 컨트롤의 RichTextBox 메서드와 함께 사용하는 경우에만 유효합니다.

UnicodePlainText 4

OLE(Object Linking and Embedding) 개체 대신 공백을 포함하는 텍스트 스트림입니다. 텍스트는 유니코드로 인코딩되어 있습니다.

예제

콘텐츠를 저장 하는 다음 예제는 RichTextBox ASCII 텍스트 파일에 있습니다. 예제에서는 SaveFileDialog 클래스 경로 파일 이름을 사용자 로부터 요청 대화 상자를 표시 합니다. 코드는 컨트롤의 내용을 해당 파일에 저장합니다. 이 예제에서는이 버전의 사용을 SaveFile ASCII 텍스트 파일 대신 표준 서식 있는 텍스트 형식으로 파일을 저장할 수 있는지를 지정 하는 방법입니다. 이 예에서는 가정에 코드가 Form 가 있는 클래스를 RichTextBox 라는 컨트롤 richTextBox1합니다.

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.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 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

설명

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

적용 대상

추가 정보