다음을 통해 공유


TextBoxBase.HideSelection 속성

정의

컨트롤이 포커스를 잃을 때 텍스트 상자 컨트롤에서 선택한 텍스트가 강조 표시되어 있는지 여부를 나타내는 값을 가져오거나 설정합니다.

public:
 property bool HideSelection { bool get(); void set(bool value); };
public bool HideSelection { get; set; }
member this.HideSelection : bool with get, set
Public Property HideSelection As Boolean

속성 값

true 텍스트 상자 컨트롤이 포커스를 잃을 때 선택한 텍스트가 강조 표시되지 않으면 이고, false은 텍스트 상자 컨트롤에 포커스가 끊어질 때 선택한 텍스트가 강조 표시된 상태로 유지되면 입니다. 기본값은 true입니다.

예제

다음 코드 예제에서는 속성을 사용 하는 방법을 보여 줍니다 HideSelection . 예제를 실행하려면 다음 코드를 양식에 붙여넣습니다. 폼의 InitializeTextBox 생성자 또는 Load 메서드에서 메서드를 호출합니다.

   //Declare a textbox called TextBox1.
internal:
   System::Windows::Forms::TextBox^ TextBox1;

private:

   //Initialize TextBox1.
   void InitializeTextBox()
   {
      this->TextBox1 = gcnew TextBox;
      this->TextBox1->Location = System::Drawing::Point( 32, 24 );
      this->TextBox1->Name = "TextBox1";
      this->TextBox1->Size = System::Drawing::Size( 136, 20 );
      this->TextBox1->TabIndex = 1;
      this->TextBox1->Text = "Type and hit enter here...";
      
      //Keep the selection highlighted, even after textbox loses focus.
      TextBox1->HideSelection = false;
      this->Controls->Add( TextBox1 );
   }
//Declare a textbox called TextBox1.
internal System.Windows.Forms.TextBox TextBox1;

//Initialize TextBox1.
private void InitializeTextBox()
{
    this.TextBox1 = new TextBox();
    this.TextBox1.Location = new System.Drawing.Point(32, 24);
    this.TextBox1.Name = "TextBox1";
    this.TextBox1.Size = new System.Drawing.Size(136, 20);
    this.TextBox1.TabIndex = 1;
    this.TextBox1.Text = "Type and hit enter here...";

    //Keep the selection highlighted, even after textbox loses focus.
    TextBox1.HideSelection = false;
    this.Controls.Add(TextBox1);
}
'Declare a textbox called TextBox1.
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox

'Initialize TextBox1.
Private Sub InitializeTextBox()
    Me.TextBox1 = New TextBox
    Me.TextBox1.Location = New System.Drawing.Point(32, 24)
    Me.TextBox1.Name = "TextBox1"
    Me.TextBox1.Size = New System.Drawing.Size(136, 20)
    Me.TextBox1.TabIndex = 1
    Me.TextBox1.Text = "Type and hit enter here..."

    'Keep the selection highlighted, even after textbox loses focus.
    TextBox1.HideSelection = False
    Me.Controls.Add(TextBox1)
End Sub

설명

이 속성을 사용하면 텍스트 상자 컨트롤에 텍스트가 강조 표시되고 다른 폼이나 대화 상자에 맞춤법 검사기 대화 상자와 같은 포커스가 있는 상태로 유지할 수 있습니다.

적용 대상