다음을 통해 공유


RichTextBox.AutoWordSelection 속성

단어 단위로 선택 기능이 활성화되어 있는지 여부를 나타내는 값을 가져오거나 설정합니다.

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

구문

‘선언
Public Property AutoWordSelection As Boolean
‘사용 방법
Dim instance As RichTextBox
Dim value As Boolean

value = instance.AutoWordSelection

instance.AutoWordSelection = value
public bool AutoWordSelection { get; set; }
public:
property bool AutoWordSelection {
    bool get ();
    void set (bool value);
}
/** @property */
public boolean get_AutoWordSelection ()

/** @property */
public void set_AutoWordSelection (boolean value)
public function get AutoWordSelection () : boolean

public function set AutoWordSelection (value : boolean)

속성 값

단어 단위로 선택 기능이 활성화되어 있으면 true이고, 그렇지 않으면 false입니다. 기본값은 true입니다.

설명

이 속성이 true로 설정된 경우 컨트롤의 텍스트 일부를 선택하면 해당 단어 전체가 선택됩니다.

예제

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

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
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 void ZoomMyRichTextBox()
{
    // Enable users to select entire word when double clicked.
    richTextBox1.set_AutoWordSelection(true);
    // Clear contents of control.
    richTextBox1.Clear();
    // Set the right margin to restrict horizontal text.
    richTextBox1.set_RightMargin(2);
    // Set the text for the control.
    richTextBox1.set_SelectedText("Alpha Bravo Charlie Delta Echo Foxtrot");
    // Zoom by 2 points.
    richTextBox1.set_ZoomFactor(2);
} //ZoomMyRichTextBox

플랫폼

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 네임스페이스