TreeView.HotTracking TreeView.HotTracking TreeView.HotTracking TreeView.HotTracking Property

정의

마우스 포인터가 지나갈 때 트리 노드 레이블이 하이퍼링크 모양을 취할지를 나타내는 값을 가져오거나 설정합니다.Gets or sets a value indicating whether a tree node label takes on the appearance of a hyperlink as the mouse pointer passes over it.

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

속성 값

true 트리 노드 레이블이으로 하이퍼링크 모양을 취하면 마우스 포인터가 지나갈; 그렇지 않으면 false합니다.true if a tree node label takes on the appearance of a hyperlink as the mouse pointer passes over it; 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 that 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 

설명

경우는 CheckBoxes 속성이 true, HotTracking 속성이 적용 되지 않습니다.If the CheckBoxes property is set to true, the HotTracking property has no effect.

참고

경우는 HotTracking 속성이 true각각 위로 마우스 포인터 전달 하이퍼링크의 모양을 노드 레이블은 트리.When the HotTracking property is set to true, each tree node label takes on the appearance of a hyperlink as the mouse pointer passes over it. 합니다 Underline 글꼴 스타일을 적용할 합니다 FontForeColor 링크로 표시 레이블 수 있도록 파랑으로 설정 됩니다.The Underline font style is applied to the Font and the ForeColor is set to blue to make the label appear as a link. 사용자의 운영 체제의 인터넷 설정에 따라 모양을 제어 되지 않습니다.The appearance is not controlled by the Internet settings of the user's operating system.

적용 대상