TreeView.HotTracking プロパティ
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)

Dim instance As TreeView Dim value As Boolean value = instance.HotTracking instance.HotTracking = value
/** @property */ public boolean get_HotTracking () /** @property */ public void set_HotTracking (boolean value)
マウス ポインタが上に配置されたときに、ツリー ノードのラベルがハイパーリンクになる場合は true。それ以外の場合は false。既定値は false です。


CheckBoxes プロパティが true に設定されている場合、HotTracking プロパティは無効です。
![]() |
---|
HotTracking プロパティが true に設定された場合は、各ツリー ノードのラベルの上にマウス ポインタが配置されると、そのラベルの外観がハイパーリンクになります。ラベルをリンクとして表示するために、Font に Underline フォント スタイルが適用され、ForeColor が青に設定されます。この外観は、ユーザーのオペレーティング システムのインターネット設定で制御されるわけではありません。 |

カスタマイズされた TreeView のコード例を次に示します。TreeView クラスを継承することにより、このカスタム バージョンには通常の TreeView の機能すべてが備わっています。ここでは、コンストラクタのさまざまなプロパティ値を変更して、固有の外観にします。ShowPlusMinus プロパティは false に設定されるため、このカスタム コントロールは、ノードがクリックされたときに展開または折りたたみが可能になるように、OnAfterSelect メソッドもオーバーライドします。
このようにしてカスタマイズしたコントロールは階層全体で使用できるため、一貫性のあるインターフェイスが簡単に作成できるようになります。プロジェクトごとにコントロールのさまざまなプロパティを指定する必要はありません。
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
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 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 extends TreeView { public CustomizedTreeView() { // Customize the TreeView control by setting various properties. set_BackColor(System.Drawing.Color.get_CadetBlue()); set_FullRowSelect(true); set_HotTracking(true); set_Indent(34); set_ShowPlusMinus(false); // The ShowLines property must be false for the FullRowSelect // property to work. set_ShowLines(false); } //CustomizedTreeView protected 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.get_Action().Equals(TreeViewAction.Unknown))) { if (e.get_Node().get_IsExpanded()) { e.get_Node().Collapse(); } else { e.get_Node().Expand(); } } // Remove the selection. This allows the same node to be // clicked twice in succession to toggle the expansion state. set_SelectedNode(null); } //OnAfterSelect }//CustomizedTreeView

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からTreeView.HotTracking プロパティを検索する場合は、下記のリンクをクリックしてください。

- TreeView.HotTracking プロパティのページへのリンク