RichTextBox.SelectionRightIndent 속성

정의

RichTextBox 컨트롤의 오른쪽 가장자리와 현재 삽입 지점에서 선택되거나 추가된 텍스트의 오른쪽 가장자리 사이의 거리(픽셀)입니다.

public:
 property int SelectionRightIndent { int get(); void set(int value); };
[System.ComponentModel.Browsable(false)]
public int SelectionRightIndent { get; set; }
[<System.ComponentModel.Browsable(false)>]
member this.SelectionRightIndent : int with get, set
Public Property SelectionRightIndent As Integer

속성 값

Int32

현재 선택 영역 또는 삽입 지점의 오른쪽에 있는 들여쓰기 공간의 크기(픽셀)입니다.

특성

예제

다음 코드 예제에서는 using 속성에서 오른쪽 여백을 RichTextBox SelectionRightIndent 만드는 방법을 보여 줍니다. 이 예제에서는 명명richTextBox1된 컨트롤이 포함된 RichTextBox 폼이 있어야 하며, 예제 코드는 폼의 클래스 내의 이벤트에서 호출되어야 합니다.

private:
   void WriteIndentedTextToRichTextBox()
   {
      // Clear all text from the RichTextBox;
      richTextBox1->Clear();

      // Specify a 20 pixel right indent in all paragraphs.
      richTextBox1->SelectionRightIndent = 20;

      // Set the font for the text.
      richTextBox1->Font = gcnew System::Drawing::Font( "Lucinda Console",12 );

      // Set the text within the control.
      richTextBox1->SelectedText = "All text is indented 20 pixels from the right edge of the RichTextBox.";
      richTextBox1->SelectedText = "You can use this property with the SelectionIndent property to provide right and left margins.";
      richTextBox1->SelectedText = "After this paragraph the indentation will end.\n\n";

      // Remove all right indentation.
      richTextBox1->SelectionRightIndent = 0;
      richTextBox1->SelectedText = "This paragraph has no right indentation. All text should flow as normal.";
   }
private void WriteIndentedTextToRichTextBox()
{
    // Clear all text from the RichTextBox;
    richTextBox1.Clear();
    // Specify a 20 pixel right indent in all paragraphs.
    richTextBox1.SelectionRightIndent = 20;
    // Set the font for the text.
    richTextBox1.Font = new Font("Lucinda Console", 12);
    // Set the text within the control.
    richTextBox1.SelectedText = "All text is indented 20 pixels from the right edge of the RichTextBox.";
    richTextBox1.SelectedText = "You can use this property with the SelectionIndent property to provide right and left margins.";
    richTextBox1.SelectedText = "After this paragraph the indentation will end.\n\n";
    // Remove all right indentation.
    richTextBox1.SelectionRightIndent = 0;
    richTextBox1.SelectedText = "This paragraph has no right indentation. All text should flow as normal.";
}
Private Sub WriteIndentedTextToRichTextBox()
   ' Clear all text from the RichTextBox;
   RichTextBox1.Clear()
   ' Set the font for the text.
   RichTextBox1.Font = New Font("Lucinda Console", 12)
   ' Specify a 20 pixel right indent in all paragraphs.
   RichTextBox1.SelectionRightIndent = 20
   ' Set the text within the control.
   RichTextBox1.SelectedText = "All text is indented 20 pixels from the right edge of the RichTextBox."
   RichTextBox1.SelectedText = "You can use this property with the SelectionIndent property to provide right and left margins."
   RichTextBox1.SelectedText = "After this paragraph the indentation will end." + ControlChars.CrLf
   ' Remove all right indentation.
   RichTextBox1.SelectionRightIndent = 0
   RichTextBox1.SelectedText = "This paragraph has no right indentation. All text should flow as normal."
End Sub

설명

현재 선택된 텍스트가 없으면 삽입 포인터가 나타나는 단락과 삽입 지점 뒤에 컨트롤에 입력된 모든 텍스트에 들여쓰기 설정이 적용됩니다. 들여쓰기 설정은 속성이 다른 값으로 변경되거나 삽입 포인터가 컨트롤 내의 다른 단락으로 이동할 때까지 적용됩니다.

컨트롤 내에서 텍스트를 선택하면 선택한 텍스트와 텍스트 선택 후 입력된 모든 텍스트에 이 속성의 값이 적용됩니다. 이 속성을 사용하여 문서에 RichTextBox포함된 단락을 들여쓰기할 수 있습니다. 단락에 표시되는 단락을 SelectionIndent 만들려면 이 속성을 함께 사용할 수 있습니다.

컨트롤의 단락에 대한 내어쓰기를 만들려면 이 속성을 사용합니다 SelectionHangingIndent .

적용 대상