I have a Windows Form with a rich-textbox with some text. Depending on what word the mouse hovers on a tooltip is displayed. But I would like to hide the tooltip when the mouse starts moving and is thus no longer hovering on a word and when the mouse hovers on a word again the tooltip is displayed again. Displaying the tooltip on certain words works perfectly but once the tooltip is displayed I have to leave and re-enter the rich-textbox to have the tooltip appear on a different word.
I've looked all over and it seems that a tooltip is only displayed once and can't be displayed again without leaving the control it is tied to but I was wondering if anybody knows of a workaround for this or can tell me why the tooltip is still being displayed on Mouse Move.
So in short I have 2 (simple) questions:
- How do I make a tooltip disappear on Mouse Move?
- How do I make the tooltip appear again on Mouse Hover without leaving the rich-textbox?
This is how the tooltip is displayed in Mouse Hover (the commented out lines don't work even in combination with the code(s) in Mouse Move):
//toolTip_tp.Active = true;
string toolTipText = "Test";
//toolTip_tp.Show(toolTipText, targetTextBox);
toolTip_tp.SetToolTip(targetTextBox, toolTipText);
I've tried the following code (individually and in combination with the commented out lines in Mouse Hover) in Mouse Move but none of it worked:
//text won't appear on hover
toolTip_tp.Hide(richTextBox_MouseOver);
toolTip_tp.SetToolTip(richTextBox_MouseOver, null);
toolTip_tp.Active = false;
toolTip_tp.RemoveAll();
toolTip_tp.Active = false;
toolTip_tp.Active = true;
//tooltip stays displayed for preset time
toolTip_tp.AutoPopDelay = 1;
toolTip_tp.AutoPopDelay = 5000;
Sorry if this is a simple question but I've been looking and trying for several days now and I just can't figure it out. Being able to solve either of the questions would be a big help.