TreeView.FullRowSelect TreeView.FullRowSelect TreeView.FullRowSelect TreeView.FullRowSelect Property

정의

강조 표시 선택 영역이 트리 뷰 컨트롤의 너비로 확장되는지를 나타내는 값을 가져오거나 설정합니다.Gets or sets a value indicating whether the selection highlight spans the width of the tree view control.

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

속성 값

true 강조 표시 선택 영역이 트리 뷰 컨트롤의 너비로 확장 되는 경우 그렇지 않으면 false합니다.true if the selection highlight spans the width of the tree view control; otherwise, false. 기본값은 false입니다.The default is false.

예제

다음 코드 예제에서는 사용자 지정 TreeView합니다.The following code example illustrates a customized TreeView. 상속 하 여 합니다 TreeView 클래스를 사용자 지정이 버전에 모든 기능의 일반적인 TreeView합니다.By inheriting the TreeView class, this custom version has all the functionality of a typical TreeView. 생성자에서 다양 한 속성 값 변경에 고유한 모양을 제공 합니다.Changing various property values in the constructor provides a unique appearance. 때문에 합니다 ShowPlusMinus 속성이로 설정 된 false, 사용자 지정된 컨트롤도 재정의 OnAfterSelect 메서드 노드를 확장 하 고 클릭할 때 축소할 수 있습니다.Because the ShowPlusMinus property is set to false, the customized control also overrides the OnAfterSelect method so nodes can be expanded and collapsed when they are clicked.

이러한 방식으로 사용자 지정 된 컨트롤을 쉽게 컨트롤 속성을 개별 프로젝트 각각 지정 하지 않고도 일관 된 인터페이스를 제공 하는 조직 전반에 걸쳐 사용할 수 있습니다.A control that is customized in this way can be used throughout an organization, making it easy to provide a consistent interface without requiring the control properties to be specified in each individual project.

public ref class CustomizedTreeView: public TreeView
{
public:
   CustomizedTreeView()
   {

      // Customize the TreeView control by setting various properties.
      BackColor = System::Drawing::Color::CadetBlue;
      FullRowSelect = true;
      HotTracking = true;
      Indent = 34;
      ShowPlusMinus = false;

      // The ShowLines property must be false for the FullRowSelect
      // property to work.
      ShowLines = false;
   }

protected:
   virtual void OnAfterSelect( TreeViewEventArgs^ e ) override
   {
      // Confirm that the user initiated the selection.
      // This prevents the first node from expanding when it is
      // automatically selected during the initialization of
      // the TreeView control.
      if ( e->Action != TreeViewAction::Unknown )
      {
         if ( e->Node->IsExpanded )
         {
            e->Node->Collapse();
         }
         else
         {
            e->Node->Expand();
         }
      }

      
      // Remove the selection. This allows the same node to be
      // clicked twice in succession to toggle the expansion state.
      SelectedNode = nullptr;
   }
};
public class CustomizedTreeView : TreeView
{
    public CustomizedTreeView()
    {
        // Customize the TreeView control by setting various properties.
        BackColor = System.Drawing.Color.CadetBlue;
        FullRowSelect = true;
        HotTracking = true;
        Indent = 34;
        ShowPlusMinus = false;

        // The ShowLines property must be false for the FullRowSelect 
        // property to work.
        ShowLines = false;
    }

    protected override void OnAfterSelect(TreeViewEventArgs e)
    {
        // Confirm that the user initiated the selection.
        // This prevents the first node from expanding when it is
        // automatically selected during the initialization of 
        // the TreeView control.
        if (e.Action != TreeViewAction.Unknown)
        {
            if (e.Node.IsExpanded) 
            {
                e.Node.Collapse();
            }
            else 
            {
                e.Node.Expand();
            }
        }

        // Remove the selection. This allows the same node to be
        // clicked twice in succession to toggle the expansion state.
        SelectedNode = null;
    }

}
Public Class CustomizedTreeView
    Inherits TreeView

    Public Sub New()
        ' Customize the TreeView control by setting various properties.
        BackColor = System.Drawing.Color.CadetBlue
        FullRowSelect = True
        HotTracking = True
        Indent = 34
        ShowPlusMinus = False

        ' The ShowLines property must be false for the FullRowSelect 
        ' property to work.
        ShowLines = False
    End Sub 'New


    Protected Overrides Sub OnAfterSelect(ByVal e As TreeViewEventArgs)
        ' Confirm that the user initiated the selection.
        ' This prevents the first node from expanding when it is
        ' automatically selected during the initialization of 
        ' the TreeView control.
        If e.Action <> TreeViewAction.Unknown Then
            If e.Node.IsExpanded Then
                e.Node.Collapse()
            Else
                e.Node.Expand()
            End If
        End If

        ' Remove the selection. This allows the same node to be
        ' clicked twice in succession to toggle the expansion state.
        SelectedNode = Nothing
    End Sub 'OnAfterSelect

End Class 'CustomizedTreeView 

설명

FullRowSelecttrue강조 표시 선택 영역이 트리 보기의 전체 너비로 확장, 방금 트리 노드 레이블의 너비를 대신 표시 합니다.When FullRowSelect is true, a selection highlight spans the entire width of the tree view, display instead of the width of just the tree node label. 합니다 FullRowSelect 속성은 무시 됩니다 ShowLines 로 설정 된 true합니다.The FullRowSelect property is ignored if ShowLines is set to true.

적용 대상