How to show node tooltip with TreeViewAdv

By | December 26, 2010

The following code snippet shows how to show and update tooltip on TreeViewAdv nodes. A tooltip is shown for the node under the mouse pointer. If the mouse is moved to another node, the tooltip is closed and opened with updated text.

C# code:

private string nodeToolTip;

private void treeView_MouseMove(object sender, MouseEventArgs e)
    // Get the node under the mouse pointer
    TreeNodeAdv node = this.treeView.GetNodeAt(treeView.PointToClient(MousePosition));

    string newToolTip = string.Empty;

    if (node != null && node.Tag != null)
        newToolTip = (node.Tag as MyNodeClass).GetTooltip();

    // Text changed?
    if (nodeToolTip != newToolTip)
        this.toolTip.SetToolTip(this.treeView, newToolTip);

        // Hide the tooltip in order to refresh.
        // If hiding is not done, the tooltip refreshes immediately.
        // Oherwise, it is shown again after the delay configured in tooltip.InitialDelay


        nodeToolTip = newToolTip;

Leave a Reply

Your email address will not be published.