다음을 통해 공유


RichTextBox.SelectionRightIndent 속성

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

네임스페이스: System.Windows.Forms
어셈블리: System.Windows.Forms(system.windows.forms.dll)

구문

‘선언
Public Property SelectionRightIndent As Integer
‘사용 방법
Dim instance As RichTextBox
Dim value As Integer

value = instance.SelectionRightIndent

instance.SelectionRightIndent = value
public int SelectionRightIndent { get; set; }
public:
property int SelectionRightIndent {
    int get ();
    void set (int value);
}
/** @property */
public int get_SelectionRightIndent ()

/** @property */
public void set_SelectionRightIndent (int value)
public function get SelectionRightIndent () : int

public function set SelectionRightIndent (value : int)

속성 값

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

설명

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

컨트롤 내에서 텍스트를 선택하는 경우 선택한 텍스트 및 텍스트를 선택한 다음 입력한 모든 텍스트는 선택한 텍스트에 적용된 이 속성의 값을 사용합니다. 이 속성을 사용하여 RichTextBox의 문서에 포함된 단락을 들여쓸 수 있습니다. 또한 이 속성을 SelectionIndent와 함께 사용하면 단락에 표시되는 단락을 만들 수 있습니다.

컨트롤에서 단락의 첫 줄 들여쓰기를 지정하려면 SelectionHangingIndent 속성을 사용합니다.

예제

다음 코드 예제에서는 SelectionRightIndent 속성을 사용하여 RichTextBox에 오른쪽 여백을 만드는 방법을 보여 줍니다. 이 예제를 실행하려면 richTextBox1이라는 RichTextBox 컨트롤이 포함된 폼이 있어야 하고, 예제 코드를 폼의 클래스 안에 있는 이벤트에서 호출한 상태여야 합니다.

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
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:
   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.set_SelectionRightIndent(20);
    // Set the font for the text.
    richTextBox1.set_Font(new Font("Lucinda Console", 12));
    // Set the text within the control.
    richTextBox1.set_SelectedText("All text is indented 20 pixels from the "
        + "right edge of the RichTextBox.");
    richTextBox1.set_SelectedText("You can use this property with the "
        + "SelectionIndent property to provide right and left margins.");
    richTextBox1.set_SelectedText("After this paragraph the indentation "
        + "will end.\n\n");
    // Remove all right indentation.
    richTextBox1.set_SelectionRightIndent(0);
    richTextBox1.set_SelectedText("This paragraph has no right indentation."
        + "All text should flow as normal.");
} //WriteIndentedTextToRichTextBox

플랫폼

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에서 지원

참고 항목

참조

RichTextBox 클래스
RichTextBox 멤버
System.Windows.Forms 네임스페이스