Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7775935
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T17:45:00+00:00 2026-06-01T17:45:00+00:00

I want to add a ToolTip to TreeView nodes and make a balloon appear

  • 0

I want to add a ToolTip to TreeView nodes and make a balloon appear at the mouse coordinates:

private void treeView1_MouseMove(object sender, MouseEventArgs e)
{
    node = treeView1.getNodeAt(e.X, e.Y);
    toolTip1 = new ToolTip();
    toolTip1.IsBalloon = true;
    toolTip1.InitialDelay = 500;
    toolTip1.SetToolTip(treeView1, node.Text);
}

The problem is that the ToolTip is assigned to the TreeView, not to the TreeNode, and the position of the balloon is quite strange – not at the expected mouse coordinates, but somewhere in treeView1.

I was trying to use toolTip1.Show() but the InitialDelay property is ignored.

How can I position a balloon ToolTip over a TreeNode and delay its display?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T17:45:01+00:00Added an answer on June 1, 2026 at 5:45 pm

    The ToolTip control is not necessary in order to display tooltips for the TreeNodes. The TreeView has a property ShowNodeToolTips that you can set to true and the TreeNodes have a ToolTipText property.


    However, if you want to display the ToolTip as a balloon, things get more complicated. Fortunately the TreeView has a NodeMouseHover event. Together with a Timer, we can make our ToolTip behave as expected.

    In our form, we make these declarations and set the timer event handler

    private const int InitialToolTipDelay = 500, MaxToolTipDisplayTime = 2000;
    
    private ToolTip toolTip = new ToolTip();
    private Timer timer = new Timer();
    private TreeNode toolTipNode;
    
    public frmTreeViewWithToolTip()
    {
        InitializeComponent();
        toolTip.IsBalloon = true;
        timer.Tick += new EventHandler(timer_Tick);
    }
    

    In NodeMouseHover we initiate the process

    private void treeView_NodeMouseHover(object sender,
                                         TreeNodeMouseHoverEventArgs e)
    {
        timer.Stop();
        toolTip.Hide(this);
    
        toolTipNode = e.Node;
    
        timer.Interval = InitialToolTipDelay;
        timer.Start();
    }
    

    The timer will be started twice: once for the initial delay and once for maximum display time of the balloon. Therefore we must handle these two cases in the timer.Tick event handler

    void timer_Tick(object sender, EventArgs e)
    {
        timer.Stop();
        if (timer.Interval == InitialToolTipDelay) { 
            Point mousePos = treeView.PointToClient(MousePosition);
    
            // Show the ToolTip if the mouse is still over the same node.
            if (toolTipNode.Bounds.Contains(mousePos)) {
                 // Node location in treeView coordinates.
                Point loc = toolTipNode.Bounds.Location;
    
                 // Node location in form client coordinates.
                loc.Offset(treeView.Location);
    
                // Make balloon point to upper right corner of the node.
                loc.Offset(toolTipNode.Bounds.Width - 7, -12);
    
                toolTip.Show("Node: " + toolTipNode.Text, this, loc);
    
                timer.Interval = MaxToolTipDisplayTime;
                timer.Start();
            }
        } else {
            // Maximium ToolTip display time exceeded.
            toolTip.Hide(this);
        }
    }
    

    Finally, we do not want to display the ToolTip if the mouse leaves the TreeView

    private void treeView_MouseLeave(object sender, EventArgs e)
    {
        timer.Stop();
        toolTip.Hide(this);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to add a tooltip to the DateTimePicker Calendar that show some informations
I want to add a tooltip using ToolTip class on a column of a
I want to add a tooltip with dinamic position change. This is js code:
$(document).ready(function() { $(#demo img[title]).tooltip({effect: 'slide'}); }); I want to add an offset to this
I want add my custom sidebar next right column all page. Please check this
I have a website built with ASP.NET (3.5) and want add some level of
I have a list of string values that I want add to a hashtable
I have numbers in javascript from 01(int) to 09(int) and I want add 1(int)
I used RollingFileAppender. And I want add a blank line to the log when
I want to add a tab to a certain tab bar from inside the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.