Windows Forms ToolTip will not re-appear after fir

2019-01-11 22:36发布

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

9条回答
聊天终结者
2楼-- · 2019-01-11 23:03

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...

查看更多
唯我独甜
3楼-- · 2019-01-11 23:03

I just had the the problem on Windows 7 so I found this thread.

In my case this did not work in tooltip_MouseEnter:

tooltip.Active = false;
tooltip.Active = true;

So I tried the following:

this.toolTip.SetToolTip(this.txtbx1, "tooltip-text");

This worked fine for me.

查看更多
太酷不给撩
4楼-- · 2019-01-11 23:09
System.Windows.Forms.ToolTip ToolTip1 = new System.Windows.Forms.ToolTip();

private void textBox_MouseHover(object sender, EventArgs e)
{
    ToolTip1.Show("YOUR TEXT", textBox);
}

private void textBox_MouseLeave(object sender, EventArgs e)
{
    ToolTip1.Active = false;
    ToolTip1.Active = true;
}
查看更多
登录 后发表回答