How to make tooltip move with mouse (winforms)

Posted by BlueRaja The Green Unicorn on Stack Overflow See other posts from Stack Overflow or by BlueRaja The Green Unicorn
Published on 2010-04-16T17:46:50Z Indexed on 2010/04/16 17:53 UTC
Read the original article Hit count: 538

Filed under:
|
|
|

I want it to move when the mouse moves, and disappear when the pointer isn't over the label.

This doesn't work:

private void lblRevisionQuestion_MouseMove(object sender, MouseEventArgs e)
{
    toolTip1.Show("test", this, PointToClient(MousePosition), Int32.MaxValue);
}

private void lblRevisionQuestion_MouseLeave(object sender, EventArgs e)
{
    toolTip1.Hide(this);
}

As soon as the tooltip appears, it steals focus away from the form, evoking MouseLeave. Then the tooltip hides, and the pointer is once again over the label, invoking MouseMove. This results in a choppy, flashing tooltip.

Is there any way to do this?

© Stack Overflow or respective owner

Related posts about c#

Related posts about winforms