How to Reset ToolTip within a control multiple times?

M

Mike in Paradise

Question: How do you reset the ToolTip that is showing
withing a control?

I have an image in a control. Within that image there are
various parts that make up the item being displayed.

I hittest the image and find out which part it is and
load the ToolTip to display part information and this
works fine for the first part.

The challenge is that I would like the tool tip to be
reset when the user moves the mouse so that they can
hoover over a different part of the image and get a new
ToolTip message with the new part of the image that they
are now hovering over.

I found some suggestions that said to change the tooltip
active flag but I tried this and it does not work.

Any suggestions would be appreciated.

Thanks




// Save the X,Y on move to pickup the part with
//
private void layout_Picture_MouseMove(object sender,
System.Windows.Forms.MouseEventArgs e)
{
this.layout_MouseX = e.X;
this.layout_MouseY = e.Y;
//Tried resetting here but no luck
//toolTip1.Active = false;
//toolTip1.Active = true;
}


private void layout_Picture_MouseHover(object sender,
System.EventArgs e)
{
int partNumber = GetPartonLayout
(layout_MouseX,layout_MouseY );

if (partNumber > 0 && partNumber <= parts_Box.Items.Count)
{
APart aPart = (APart)parts_Box.Items[partNumber - 1];
this.toolTip1.SetToolTip(this.layout_Picture
,aPart.PartName
+",L="+aPart.Length.ToString() );
}
else
{
this.toolTip1.SetToolTip(this.layout_Picture
,"Click on a Part to select it, Hover mouse over a part
to see its Length");
}
}
 
P

Praveen Ramesh

This is the settings I have in a similar use case:

tooltip = new ToolTip();
tooltip.ShowAlways = true;
tooltip.AutomaticDelay = 0;
tooltip.AutoPopDelay = 0;
tooltip.ReshowDelay = 0;
tooltip.InitialDelay = 0;

And then whenever the mouse moves to a new "part", simply call SetToolTip
method as follows:

this.tooltip.SetToolTip(this, newtooltipText);

Does this not work?

Regards,
Praveen Ramesh
Syncfusion, Inc.
visit www.syncfusion.com for .Net Essentials
 
M

Mike in Paradise

I tried changing the tooltip settings to those in your
post and this still works the same. The problem is that
the tooltip needs to activate itself more than once
within the same control which is a standard windows
picturebox.

This is only one of many controls on the form and
tabcontrols so I cannot set it with:
this.tooltip.SetToolTip(this, newtooltipText);

but need to set it just for the specific control.

I tried changing the control focus on the mouse move to
try and reactivate it but no luck yet.

Thanks for the suggestions, I will keep digging...

-----Original Message-----
This is the settings I have in a similar use case:

tooltip = new ToolTip();
tooltip.ShowAlways = true;
tooltip.AutomaticDelay = 0;
tooltip.AutoPopDelay = 0;
tooltip.ReshowDelay = 0;
tooltip.InitialDelay = 0;

And then whenever the mouse moves to a new "part", simply call SetToolTip
method as follows:

this.tooltip.SetToolTip(this, newtooltipText);

Does this not work?

Regards,
Praveen Ramesh
Syncfusion, Inc.
visit www.syncfusion.com for .Net Essentials

Question: How do you reset the ToolTip that is showing
withing a control?

I have an image in a control. Within that image there are
various parts that make up the item being displayed.

I hittest the image and find out which part it is and
load the ToolTip to display part information and this
works fine for the first part.

The challenge is that I would like the tool tip to be
reset when the user moves the mouse so that they can
hoover over a different part of the image and get a new
ToolTip message with the new part of the image that they
are now hovering over.

I found some suggestions that said to change the tooltip
active flag but I tried this and it does not work.

Any suggestions would be appreciated.

Thanks




// Save the X,Y on move to pickup the part with
//
private void layout_Picture_MouseMove(object sender,
System.Windows.Forms.MouseEventArgs e)
{
this.layout_MouseX = e.X;
this.layout_MouseY = e.Y;
//Tried resetting here but no luck
//toolTip1.Active = false;
//toolTip1.Active = true;
}


private void layout_Picture_MouseHover(object sender,
System.EventArgs e)
{
int partNumber = GetPartonLayout
(layout_MouseX,layout_MouseY );

if (partNumber > 0 && partNumber <= parts_Box.Items.Count)
{
APart aPart = (APart)parts_Box.Items[partNumber - 1];
this.toolTip1.SetToolTip(this.layout_Picture
,aPart.PartName
+",L="+aPart.Length.ToString() );
}
else
{
this.toolTip1.SetToolTip(this.layout_Picture
,"Click on a Part to select it, Hover mouse over a part
to see its Length");
}
}


.
 
Top