TreeNode.ToolTipText Property

Gets or sets the text that appears when the mouse pointer hovers over a TreeNode.

Namespace:  System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

public string ToolTipText { get; set; }

Property Value

Type: System.String
Gets the text that appears when the mouse pointer hovers over a TreeNode.

You must set the ShowNodeToolTips property of the parent TreeView to true for the ToolTipText to be visible at run time.

If the TreeView control has a ToolTip and also contains a TreeNode that has a ToolTip, only the ToolTip for the node will be shown.

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);

}

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft