how to display tooltip for infinity time? RRS feed

  • Question


    hi, I want to know how to display a tooltip forever as long as the mouse still at the control.

    I only find AutoPopDelay property to set the time but cannot set the time to be infinity.

    anyone can help?

    thanks in advance

    Friday, May 19, 2006 6:36 AM

All replies


    any ideas?

    Sunday, May 21, 2006 1:55 PM
  • I notice that there is a protected method on the ToolTip class called StopTimer.

    It seems to be what you are looking for. Only problem is that you would have to created a derived class of ToolTip and make sure that it gets used instead of the normal tooltip.


    Monday, May 22, 2006 3:04 AM


    I tried the following code but it does not work, the tooltip disappears after a while.


    class Class1 : System.Windows.Forms.ToolTip


    public void stopTimer() { this.StopTimer(); }//StopTimer(); }



    partial class Form1


    private void InitializeComponent()


    this.a = new WindowsApplication1.Class1();


    // a


    this.a.AutoPopDelay = 5000;

    this.a.InitialDelay = 500;

    this.a.ReshowDelay = 100;

    this.a.Popup += new System.Windows.Forms.PopupEventHandler(this.a_Popup);

    this.a.Draw += new System.Windows.Forms.DrawToolTipEventHandler(this.a_Draw);


    private Class1 a;



    private void a_Popup(object sender, PopupEventArgs e)





    Did i miss anything?

    Thank you

    Monday, May 22, 2006 6:42 AM
  • Not sure but I would suggest that you call StopTimer() in InitializeComponent(). You should only really need to ever call it once.

    Also, the most likely problem I can see is that for some reason the Popup event isn't being triggered - meaning that StopTimer() never gets called.

    Apart from that it looks ok. ButI am just going from the examples on MSDN. I'm not that experienced with tooltips.

    Monday, May 22, 2006 8:33 PM

    still does not work...



    Tuesday, May 23, 2006 1:01 AM
  • You could try just creating your own custom tooltip... Here's an example I wrote that will create a tooltip that persists as long as you keep your mouse over it.

    using System;

    using System.Collections.Generic;

    using System.ComponentModel;

    using System.Data;

    using System.Drawing;

    using System.Text;

    using System.Windows.Forms;

    using System.Threading;


    namespace WindowsApplication1


        public partial class Form1 : Form


            public Form1()





            private void Form1_Load(object sender, EventArgs e)


                Button b = new Button();

                b.Text = "test";



                MyToolTip t = new MyToolTip(b, "test tooltip");




        public class MyToolTip : Label


            System.Threading.Thread myThread;

            Control parentCtrl;

            bool ctrlAdded = false;

            bool mouseOver = false;


            public MyToolTip(Control c, string caption)


                this.Text = caption;

                this.Top = c.Top + 15;

                this.Left = c.Left + 35;

                this.BackColor = Color.Ivory;

                this.BorderStyle = BorderStyle.FixedSingle;


                c.MouseEnter += new EventHandler(ShowTip);

                c.MouseLeave += new EventHandler(HideTip);

                parentCtrl = c;



            public void ShowTip(object sender, EventArgs e)


                if (ctrlAdded == false)




                    this.MouseEnter += new EventHandler(PersistTrue);

                    this.MouseLeave += new EventHandler(PersistFalse);



                    this.Visible = true;


                ctrlAdded = true;



            public void HideTip(object sender, EventArgs e)


                myThread = new System.Threading.Thread(new





            public void UpdateVisibility()



                if (!this.mouseOver)

                    this.Visible = false;



            public void PersistTrue(object sender, EventArgs e)


                mouseOver = true;



            public void PersistFalse(object sender, EventArgs e)


                mouseOver = false;






    Wednesday, May 24, 2006 5:52 PM
  • Instead of turning it to infinity, you can set it to Int32.MaxValue, which would be 2.147.483.647.
    Let's say
    2.147.483 s, i.e. about 596 hours, i.e.  about 24 days.

    I think it might suffice to your needs :)

    [Edit: doesn't work though...]
    MSDN says: "The maximum time you can delay a popup is 5000 milliseconds. For longer durations, use the Show method to control the exact moment when the ToolTip is displayed." (very badly translated in french however, that's why I wasn't aware of)
    And more details here
    Thursday, February 25, 2010 11:02 AM