Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tooltip displays inconsistantly

I have a simple winforms form (used as a modal dialog) with several controls on it. I want to display a tooltip for one of the textbox controls. I have added a tooltip component to my form, and did a 'SetToolTip' call in the constructor of the form for the desired control. I am using default values for the various delay properties.

Display of the tooltip is very erratic. When the mouse is over the textbox, sometimes the tooltip displays. Sometimes it will only display when I move the cursor while over the control. Moving the cursor out and back in may get the tooltip to display. When it does display the timing seems much longer than InitialDelay. If it does work a few times, it then stops working, and no amount of leaving/entering the control will make the tooltip appear again.

I tried setting ShowAlways to true, but that didn't make any difference.

Any suggestions for getting my tooltip to work reliably?

Thanks.

like image 804
JNygren Avatar asked Nov 03 '22 11:11

JNygren


1 Answers

I've had tooltips working reliably before and here's what I did to replicate it.

I placed a textbox, label and ToolTip control on a form which I'm using as my modal dialog.

My MouseEnter event handler for the textbox looks as follows:

    private void textBox1_MouseEnter(object sender, EventArgs e)
    {
        int XOffset = 0;
        int YOffset = -55;
        int Duration = 3000;

        toolTip1.ToolTipTitle = "ToolTip.";

        toolTip1.Show( "This is my tooltip. there are many like it but this one is mine",
               textBox1, XOffset, YOffset, Duration);
    }

That's it. The ToolTip appears for 3 seconds when I enter the textbox with the mouse, then disappears, and does so consistently. Note I didn't have to call "SetToolTip" anywhere. Also, make your offsets so the tooltip isn't obscuring any part of the control as this seems to cause weirdness.

like image 112
Gareth Avatar answered Jan 04 '23 15:01

Gareth