Windows Develop Bookmark and Share   
 index > Windows Forms General > Flickering ToolTip on Vista
 

Flickering ToolTip on Vista

Why the tooltip on any control with Vista always flickers without stop when the mouse move over the control,such as button control ,label control , checkbox control and textbox control etc . All of controls run on Vista appear flickering issue in despite of .net framework 1.1 or 2.0.

But that would be ok on earlier windows OS.

This seems to be rendering issue with windows vista.

Detail Steps:

1) Drag a button control and a tooltip control on form

2) Use the button MouseMove event

3) add some code like the below

private void button1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
this.toolTip1.SetToolTip(button1,"Flickering ToolTip on Button!");
}

Run the winform , move mouse over the button , the flickering tooltip would be shown

joyson  Wednesday, November 01, 2006 12:20 PM

Why the tooltip on any control with Vista always flickers without stop when the mouse move over the control,such as button control ,label control , checkbox control and textbox control etc . All of controls run on Vista appear flickering issue in despite of .net framework 1.1 or 2.0.

But that would be ok on earlier windows OS.

This seems to be rendering issue with windows vista.

Detail Steps:

1) Drag a button control and a tooltip control on form

2) Use the button MouseMove event

3) add some code like the below

private void button1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
this.toolTip1.SetToolTip(button1,"Flickering ToolTip on Button!");
}

Run the winform , move mouse over the button , the flickering tooltip would be shown

joyson  Wednesday, November 01, 2006 12:17 PM

If flickers because you are not using the tooltips correctly. You just need to set the ToolTip property of the button in designer or if you really want to do it from code you should try to use MouseEnter event and not MouseMove. MouseMove is raised whenever the user moves the mouse causing the tooltip to be set every time.

Mike Danes  Wednesday, November 01, 2006 1:23 PM

Thanks Mike , quite so like simple control(set the ToolTip property of the button in designer).

But the other control like ListView , as we all know ,if set the ToolTip property of the ListView , the ToolTip would be shown only mouse on the first column ,this is not welcome.The ToolTip shows on the second column is what I want .

I use mouse over event , just want to get the mouse coordinate , just like :

private void listView1_MouseMove(object sender, MouseEventArgs e){

int startLocation = listView1.Location.X + listView1.Columns[0].Width;
int endLocation = listView1.Location.X + listView1.Columns[0].Width + listView1.Columns[1].Width;

ListViewItem selection = listView1.GetItemAt(e.X, e.Y);

if (e.Y > startLocation &&e.X <= endLocation)
{

if (selection != null)
{
this.toolTip1.SetToolTip(listView1, selection.SubItems[1].Text);
}
}
}

if use mouse enter orhover event , how can I get the mouse coordinate ,just like :

listView1_MouseEnter(object sender, EventArgs e)

In addition , Mouse Enter event causes that the ToolTip shows as long as the mouse enter the control .

joyson  Thursday, November 02, 2006 2:37 AM

Fortunately , I solved the problem . This way seems like a little stupid.

Declare variable x and y stand for x and y coordinate ,when trigger the mouse move event ,compare x and y with the new coordinate ,if equal and then do nothing otherwise show the tooltip . That way can avoid flickering tooltip.

int x = 0,y = 0;

if(x == e.X && y == e.Y)
return;

else {

x = e.X;

y = e.Y;

//show tooltip code here

}

joyson  Thursday, November 02, 2006 7:08 AM

I played a bit more with this and it seems is not a rendering problem but a problem with the MouseMove message. If you move the mouse over an item the tooltip is shown and another MouseMove message is delivered to the ListView without the mouse being actually moved. In response you set again the tooltip and you get another MouseMove message and so on and the CPU usage goes to 100%.

I saw another thread on another problem but that also caused MouseMove message to be delivered without the mouse being actually moved and that resulted in this kind of loop so I suppose it's a problem in the current builds of Vista and hopefully it's going to be fixed in the final build.

Mike Danes  Thursday, November 02, 2006 8:54 AM

Exactly Right!

Thanks for your response!

joyson  Friday, November 03, 2006 2:16 AM

i got some solutiions like moving the code to mouse hover insted of mouse move. it solves the problem in xp but not in vista.

looks like microsoft service pack has to solve this issue. it is out of control Sad

Shamirza  Tuesday, July 24, 2007 6:27 AM

Though avery old post, and i faced a problem similar to this. I thought i will share the solution in the forum.

Only change the Toolstrip when its different from the already shown tooltip in MouseMove event. I will modify your code and you can test it.

private void button1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
{

string toolTip = "Flickering ToolTip on Button!";

if(string.Compare(this.toolTip1.GetToolTip(button1),toolTip)!=0) 
  {
       this.toolTip1.SetToolTip(button1,toolTip);
  }

}

Kavitesh Singh.
Kavitesh Singh  Friday, May 15, 2009 7:02 PM

You can use google to search for other answers

Custom Search

More Threads

• HTML generated by Webbrowser control
• Raw stretching of image
• A problem with SHDocVW.dll
• Delete Item CheckedListBox
• Building textboxes during runtime - this one is tricky
• BeginInvoke not wokring
• DataGridView.CellPainting doesn't paint
• WinForm - Title Bar
• Setting the mouse cursor for a foreign window
• AXIMP: referenced rcw generates error