Bewerken

Delen via


TreeView.ShowNodeToolTips Property

Definition

Gets or sets a value indicating ToolTips are shown when the mouse pointer hovers over a TreeNode.

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

Property Value

true if ToolTips are shown when the mouse pointer hovers over a TreeNode; otherwise, false. The default is false.

Examples

The following code example demonstrates how to use the ToolTipText and ShowNodeToolTips properties. To run this example, paste the following code into a Windows Form and call InitializeTreeViewWithToolTips from the form's constructor or Load event handler.

TreeView treeViewWithToolTips;
private void InitializeTreeViewWithToolTips()
{
    treeViewWithToolTips = new TreeView();
    TreeNode node1 = new TreeNode("Node1");
    node1.ToolTipText = "Help for Node1";
    TreeNode node2 = new TreeNode("Node2");
    node2.ToolTipText = "A Tip for Node2";
    treeViewWithToolTips.Nodes.AddRange(new TreeNode[] { node1, node2 });
    treeViewWithToolTips.ShowNodeToolTips = true;
    this.Controls.Add(treeViewWithToolTips);
}
Private treeViewWithToolTips As TreeView

Private Sub InitializeTreeViewWithToolTips() 
    treeViewWithToolTips = New TreeView()
    Dim node1 As New TreeNode("Node1")
    node1.ToolTipText = "Help for Node1"
    Dim node2 As New TreeNode("Node2")
    node2.ToolTipText = "A Tip for Node2"
    treeViewWithToolTips.Nodes.AddRange(New TreeNode() {node1, node2})
    treeViewWithToolTips.ShowNodeToolTips = True
    Me.Controls.Add(treeViewWithToolTips)

End Sub

Remarks

In order for ToolTips to be visible, you must set the ToolTipText for a TreeNode.

Applies to

See also