Taonias
Taonias

Reputation: 71

ToolStrip Buttons flashes

I have a windows form with a toolstip in it with several buttons. When the mouse is over a button of the toolstip then the toolstrip button starts to flash... looks like it gets and loses focus every second. That results for the click to do nothing if the user click at the time that the button has no focus therefore the user has to click the button again and again util he gets the timing correct.

Does anyone knows anything about this?

I rally need some answers as soon as possible...

Thank you very much

Upvotes: 2

Views: 968

Answers (2)

ctusch
ctusch

Reputation: 1010

Here is the code for showing the tool tip above the item manually:

private readonly ToolTip currentToolTip = new ToolTip();

private void ToolStripItem_MouseEnter(object sender, EventArgs e)
{
    ToolStripItem item = (ToolStripItem)sender;
    this.currentToolTip.Show(item.ToolTipText, item.Owner, item.Bounds.X, -20);
}

private void ToolStripItem_MouseLeave(object sender, EventArgs e)
{
    ToolStripItem item = (ToolStripItem)sender;
    this.currentToolTip.Hide(item.Owner);
}

You have to add the event handlers to all your ToolStripItems and set the ToolStrips' ShowItemToolTips to false.

Upvotes: 1

Taonias
Taonias

Reputation: 71

I have found the reason... The toolstrips in windows forms have by default the tooltips set to Auto and if the tooltip opens on the taskbar then the toolstrip loses focus.

The solution to this is to either disable the tooltips or to set it to manual and show the tooltip at another place.

Upvotes: 4

Related Questions