TextBoxBase.HideSelection 속성

정의

TextBox 컨트롤이 포커스를 잃을 때 해당 컨트롤에서 선택한 텍스트가 강조 표시된 상태로 남아 있는지 여부를 나타내는 값을 가져오거나 설정합니다.

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

속성 값

Boolean

TextBox 컨트롤이 포커스를 잃을 때 선택한 텍스트가 강조 표시된 상태로 유지되지 않으면 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

설명

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

적용 대상