TreeView.HideSelection TreeView.HideSelection TreeView.HideSelection TreeView.HideSelection Property

정의

트리 뷰에서 포커스가 사라질 때에도 선택된 트리 노드에서 강조 표시된 상태를 유지할지를 나타내는 값을 가져오거나 설정합니다.Gets or sets a value indicating whether the selected tree node remains highlighted even when the tree view has lost the focus.

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 if the selected tree node is not highlighted when the tree view has lost the focus; otherwise, false. 기본값은 true입니다.The default is true.

예제

다음 코드 예제를 사용 하는 방법에 설명 합니다 HideSelection 속성입니다.The following code example demonstrates how to use the HideSelection property. 이 예제를 실행 하려면 호출을 폼에 다음 코드를 붙여 넣습니다 합니다 InitializeSelectedTreeView 폼의 생성자 또는 Load 이벤트 처리기입니다.To run this example, paste the following code in a form and call the InitializeSelectedTreeView method in the form's constructor or Load event handler.

System::Windows::Forms::TreeView^ TreeView2;

// Initialize the TreeView to blend with the form, giving it the 
// same color as the form and no border.
void InitializeSelectedTreeView()
{
   
   // Create a new TreeView control and set the location and size.
   this->TreeView2 = gcnew System::Windows::Forms::TreeView;
   this->TreeView2->Location = System::Drawing::Point( 72, 48 );
   this->TreeView2->Size = System::Drawing::Size( 200, 200 );
   this->TreeView2->BorderStyle = BorderStyle::Fixed3D;
   
   // Set the HideSelection property to false to keep the 
   // selection highlighted when the user leaves the control. 
   this->TreeView1->HideSelection = false;
   
   // Add the nodes.
   array<TreeNode^>^temp0 = {gcnew TreeNode( "Full Color" ),gcnew TreeNode( "Project Wizards" ),gcnew TreeNode( "Visual C# and Visual Basic Support" )};
   array<TreeNode^>^temp1 = {gcnew TreeNode( "Pentium 133 MHz or faster processor " ),gcnew TreeNode( "Windows 98 or later" ),gcnew TreeNode( "100 MB Disk space" )};
   array<TreeNode^>^temp2 = {gcnew TreeNode( "Features",temp0 ),gcnew TreeNode( "System Requirements",temp1 )};
   this->TreeView1->Nodes->AddRange( temp2 );
   
   // Set the tab index and add the TreeView to the form.
   this->TreeView1->TabIndex = 0;
   this->Controls->Add( this->TreeView1 );
}


// Declare the TreeView control.
internal System.Windows.Forms.TreeView TreeView2;

// Initialize the TreeView to blend with the form, giving it the 
// same color as the form and no border.
private void InitializeSelectedTreeView()
{

	// Create a new TreeView control and set the location and size.
	this.TreeView2 = new System.Windows.Forms.TreeView();
	this.TreeView2.Location = new System.Drawing.Point(72, 48);
	this.TreeView2.Size = new System.Drawing.Size(200, 200);

	this.TreeView2.BorderStyle = BorderStyle.Fixed3D;
	
	// Set the HideSelection property to false to keep the 
	// selection highlighted when the user leaves the control. 
	// This helps it blend with form.
	this.TreeView2.HideSelection = false;

	// Add the nodes.
	this.TreeView2.Nodes.AddRange(new TreeNode[]
		{new TreeNode("Features", 
			new TreeNode[]{
			new TreeNode("Full Color"), 
			new TreeNode("Project Wizards"), 
			new TreeNode("Visual C# and Visual Basic Support")}), 
			new TreeNode("System Requirements", 
			new TreeNode[]{
				new TreeNode("Pentium 133 MHz or faster processor "),
				new TreeNode("Windows 98 or later"), 
				new TreeNode("100 MB Disk space")})
		});

	// Set the tab index and add the TreeView to the form.
	this.TreeView2.TabIndex = 0;
	this.Controls.Add(this.TreeView2);
}

' Declare the TreeView control.
Friend WithEvents TreeView2 As System.Windows.Forms.TreeView

' Initialize the TreeView to blend with the form, giving it the 
' same color as the form and no border.
Private Sub InitializeSelectedTreeView()

    ' Create a new TreeView control and set the location and size.
    Me.TreeView2 = New System.Windows.Forms.TreeView
    Me.TreeView2.Location = New System.Drawing.Point(72, 48)
    Me.TreeView2.Size = New System.Drawing.Size(200, 200)
    Me.TreeView2.BorderStyle = BorderStyle.Fixed3D
   
    ' Set the HideSelection property to false to keep the 
    ' selection highlighted when the user leaves the control. 
    Me.TreeView2.HideSelection = False

    ' Add the nodes.
    Me.TreeView2.Nodes.AddRange(New System.Windows.Forms.TreeNode() _
        {New System.Windows.Forms.TreeNode("Features", _
        New System.Windows.Forms.TreeNode() _
        {New System.Windows.Forms.TreeNode("Full Color"), _
        New System.Windows.Forms.TreeNode("Project Wizards"), _
        New System.Windows.Forms.TreeNode("Visual C# and Visual Basic Support")}), _
        New System.Windows.Forms.TreeNode("System Requirements", _
        New System.Windows.Forms.TreeNode() _
        {New System.Windows.Forms.TreeNode _
        ("Pentium 133 MHz or faster processor "), _
        New System.Windows.Forms.TreeNode("Windows 98 or later"), _
        New System.Windows.Forms.TreeNode("100 MB Disk space")})})

    ' Set the tab index and add the TreeView to the form.
    Me.TreeView2.TabIndex = 0
    Me.Controls.Add(Me.TreeView2)
End Sub

설명

이 속성 설정 된 경우 false에서 선택 된 노드를 TreeView 컨트롤에서 현재 선택 영역을 다른 색 강조 표시 됩니다 때 색을 TreeView 컨트롤이 포커스를 잃을.When this property is set to false, selected nodes in the TreeView control remain highlighted in a different color than the current selection color when the TreeView control loses focus. 사용자 폼에서 다른 컨트롤을 클릭 하거나 다른 창으로 이동 하면 표시 되는 사용자가 선택 되는 항목을 유지 하려면이 속성을 사용할 수 있습니다.You can use this property to keep items that are selected by the user visible when the user clicks a different control on the form or moves to a different window.

참고

애플리케이션의 액세스 가능성을 고려 하는 것이 좋습니다 설정 하는 HideSelection 속성을 false입니다.If you are concerned with the accessibility of your applications, it is recommended that you set the HideSelection property to false.

적용 대상

추가 정보