I have a tooltip that is appearing on mouse hover on an image:
ToolTip tt = new ToolTip();
protected virtual void pictureBox_MouseHover(object sender, EventArgs e)
{
tt.InitialDelay = 0;
tt.SetToolTip(this.pictureBox, "Click 'LIVE ...");
}
My problem is that my text is rather long, and the tooltip disappears too fast. How can I get the tool tip to be displayed for longer?
Set theAutoPopDelay
property to be something higher - it defaults to 5000 (5 seconds)Update: My mistake:
So you can't get the tool tip to be displayed for longer than 5 seconds using this method - instead you need to use the Show to explicitly show the tool tip when the user hovers over the picturebox. Just replace your call to
SetToolTip
with one toShow
in yourMouseHover
event handler:Unlike the answer described by Justin, I was not able to get the ToolTip to display for longer than the 5 seconds using the
show
method.One of the other hangups I was having was the
AutomaticDelay
property. Long story short - if you want customAutoPopDelay
do not setAutomaticDelay
.Setting this property will automatically set... see MSDN:
Here's code that worked for me:
Bonus:
Set the value of AutoPopDelay property
ToolTip.Show(text, [control], time in milliseconds)
is what you need i thinkThis will let you display your long text for a specific number of milliseconds. Also if you text is too long then you could inert
NewLine
in between the text so that its wrapped up and not shown as a long tooltip spanning across the formI've found the following steps work for me:
Set the automaticdelay to 1/10 of your desired autopopdelay.
Then you can adjust your initialdelay and your reshowdelayafterwards.
MSDN Link