TreeView.HotTracking 속성

정의

마우스 포인터가 지나갈 때 트리 노드 레이블이 하이퍼링크 모양을 취할지 여부를 나타내는 값을 가져오거나 설정합니다.

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

속성 값

Boolean

마우스 포인터가 지나갈 때 트리 노드 레이블이 하이퍼링크 모양을 취하면 true이고, 그렇지 않으면 false입니다. 기본값은 false입니다.

예제

다음 코드 예제에서는 사용자 지정된 TreeView. 이 사용자 지정 버전은 클래스를 TreeView 상속하여 일반적인 TreeView모든 기능을 갖습니다. 생성자에서 다양 한 속성 값 변경에 고유한 모양을 제공 합니다. 속성이 ShowPlusMinus 설정 false되기 때문에 사용자 지정된 컨트롤은 노드를 클릭할 때 확장 및 축소할 수 있도록 메서드를 재정 OnAfterSelect 의합니다.

이러한 방식으로 사용자 지정 된 컨트롤을 쉽게 컨트롤 속성을 개별 프로젝트 각각 지정 하지 않고도 일관 된 인터페이스를 제공 하는 조직 전반에 걸쳐 사용할 수 있습니다.

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


    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

End Class

설명

속성이 CheckBoxes 설정 true되면 속성에 HotTracking 영향을 주지 않습니다.

참고

속성이 HotTracking 설정 true되면 마우스 포인터가 하이퍼링크를 통과할 때 각 트리 노드 레이블이 하이퍼링크의 모양을 사용합니다. Underline 글꼴 스타일이 적용 Font 되고 ForeColor 레이블이 링크로 표시되도록 파란색으로 설정됩니다. 모양은 사용자 운영 체제의 인터넷 설정에 의해 제어되지 않습니다.

적용 대상