Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows Forms ToolTip will not re-appear after first use

Tags:

I have a Windows Forms C# application where I would like to use a tooltip on one of the text boxes. I initialize the tool-tip in the constructor of the Form class, and it works the first time. So when I hover over the text box with my mouse it works, but once the toolTip times out and it goes away, it does not re-appear when I move my mouse away and back onto the control. I would expect it to come back. What am I doing wrong?

Here is how I initialize the tooltip:

myTip = new ToolTip(); myTip.ToolTipIcon = ToolTipIcon.Info; myTip.IsBalloon = true; myTip.ShowAlways = true;  myTip.SetToolTip(txtMyTextBox,"My Tooltip Text"); 
like image 659
7wp Avatar asked Feb 18 '09 03:02

7wp


People also ask

How do I refresh WinForm?

You can use the Form. Invalidate(); or Form. Refresh(); methods.

How do I use ToolTip in Windows form?

In Visual Studio, add a ToolTip component to the form. Select the control that will display the ToolTip, or add it to the form. In the Properties window, set the ToolTip on ToolTip1 value to an appropriate string of text.

How many ToolTip objects are required on a Windows Form?

One object is enough for the entire form.

Are Windows Forms deprecated?

Win Form has been used to develop many applications. Because of its high age (born in 2003), WinForm was officially declared dead by Microsoft in 2014. However, Win Form is still alive and well.


2 Answers

I had a similar problem today. Sometimes, the tooltip would not show. I had one ToolTip control for all the controls in my form.

I also had a MouseEnter event on all the controls added automatically, so I modified the MouseEnter event to do:

_tooltip.Active = false; _tooltip.Active = true; 

It fixed the bug, but I don't know why.

Also, the bug always happened on Windows XP machines, but not on Windows Vista.

like image 135
Kevin Doyon Avatar answered Oct 08 '22 02:10

Kevin Doyon


I guess you'll be happy to know that Microsoft knows about it...since about 5 years...

  • 2/21/2005 Bug acknowledged as reproducable
  • 3/29/2005 Hum we might fix it, but later...
  • 11/15/2005 Well actually it's not a big bug, and it doesn't happen much, so we won't fix it.

Damn I love it when I stumble on bugs Microsoft doesn't want to solve! This time it's called a corner case, last time it was simply too difficult to resolve...

http://connect.microsoft.com/VisualStudio/feedback/details/115385/tooltip-stop-showing-after-autopopdelay

I'm off to tell my client that the bugs in my program are just corner cases and too difficult to resolve...

like image 26
user276648 Avatar answered Oct 08 '22 00:10

user276648