RichTextBox.RightMargin 속성

정의

RichTextBox 컨트롤 내에서 한 줄의 텍스트 크기를 가져오거나 설정합니다.

public:
 property int RightMargin { int get(); void set(int value); };
public int RightMargin { get; set; }
member this.RightMargin : int with get, set
Public Property RightMargin As Integer

속성 값

Int32

컨트롤 내에 있는 한 줄의 텍스트 크기(픽셀)입니다. 기본값은 0입니다.

예외

지정된 값이 0보다 작은 경우

예제

다음 코드 예제에서는 텍스트를 확대하고, 단어를 두 번 클릭할 때 컨트롤의 텍스트에서 단어를 자동으로 선택하고, 컨트롤의 클라이언트 영역 오른쪽에 여백이 있는 단어를 만드는 RichTextBox 방법을 보여 줍니다. 컨트롤의 너비가 RichTextBox 작으면 이 코드를 사용하면 텍스트의 각 문자가 자체 줄에 표시되는 위치가 만들어집니다 RichTextBox . 이 세로 표시 위치에 있는 동안 단어의 일부를 클릭하면 텍스트가 세로로 표시되는 사실에 관계없이 단어의 모든 문자가 선택됩니다. 이 예제에서는 명명richTextBox1된 컨트롤을 포함하는 폼이 RichTextBox 있어야 합니다.

private:
   void ZoomMyRichTextBox()
   {
      // Enable users to select entire word when double clicked.
      richTextBox1->AutoWordSelection = true;

      // Clear contents of control.
      richTextBox1->Clear();

      // Set the right margin to restrict horizontal text.
      richTextBox1->RightMargin = 2;

      // Set the text for the control.
      richTextBox1->SelectedText = "Alpha Bravo Charlie Delta Echo Foxtrot";

      // Zoom by 2 points.
      richTextBox1->ZoomFactor = 2.0f;
   }
private void ZoomMyRichTextBox()
{
    // Enable users to select entire word when double clicked.
    richTextBox1.AutoWordSelection = true;
    // Clear contents of control.
    richTextBox1.Clear();
    // Set the right margin to restrict horizontal text.
    richTextBox1.RightMargin = 2;
    // Set the text for the control.
    richTextBox1.SelectedText = "Alpha Bravo Charlie Delta Echo Foxtrot";
    // Zoom by 2 points.
    richTextBox1.ZoomFactor = 2.0f;
}
Private Sub ZoomMyRichTextBox()
    ' Enable users to select entire word when double clicked.
    richTextBox1.AutoWordSelection = True
    ' Clear contents of control.
    richTextBox1.Clear()
    ' Set the right margin to restrict horizontal text.
    richTextBox1.RightMargin = 2
    ' Set the text for the control.
    richTextBox1.SelectedText = "Alpha Bravo Charlie Delta Echo Foxtrot"
    ' Zoom by 2 points.
    richTextBox1.ZoomFactor = 2.0F
End Sub

설명

컨트롤에 0보다 큰 값을 입력하면 컨트롤 왼쪽에서 지정된 픽셀 수로 컨트롤에 보이지 않는 여백이 배치됩니다. 이 여백 이상으로 확장되는 입력한 텍스트는 컨트롤의 다음 텍스트 줄에 배치됩니다. 이 속성은 현재 컨트롤에 입력된 모든 텍스트와 속성이 설정된 후 컨트롤에 입력된 추가 텍스트에 영향을 줍니다. 컨트롤에 입력 된 모든 텍스트에 대 한 최대 줄 너비를 지정 하려면이 속성을 사용할 수 있습니다 RichTextBox .

적용 대상