question

ChristKingKennedy-5906 avatar image
0 Votes"
ChristKingKennedy-5906 asked ·

ToolTip on same control

writing in C#, I've created a class that displays its own 'objects' onto a single picturebox in a way similar to how C# creates objects and puts them on a form. (it uses a Sweep & Prune algorithm to detect what object is under the mouse and is intended to be similar to regular VS objects like Label, Button, ComboBox, etc...)

I have a ToolTip object but there is only the one PictureBox Control for it to associate with.
at the ToolTip_PopUp() event it asks itself 'what object is under the mouse' (still in the same PictureBox) but since the VS ToolTip only triggers the PopUp event when it detects a new control (different from the last) under the mouse I can't get the ToolTip to trigger twice on the same PictureBox for two different 'regions' (my objects) on it.
I've tried setting the ToolTip.Active property Off/On whenever the mouse moves over this PictureBox but that doesn't seem to be working either.

the PopUp_Event() works fine when it is triggered but ToolTip won't trigger twice on the same control.
is there a way to 'Reset' the ToolTip and get it to do its business more than once on the same control?

dotnet-csharp
· 2
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Have not seen this happen in regards to fail on a second or more attempts.

You can set a ToolTip via code e.g. and even so if there is something odd in your code it could interfere with the tool-tip showing.
toolTip1.SetToolTip(SomePictureBox, "Some text");

0 Votes 0 ·

thank you for your reply,
the tool tip works but it won't call the PopUp_Event() unless the mouse cursor is moved away from my one PictureBox and returns to it, that's my problem.
I need it to keep calling the PopUp_Event() even though the mouse cursor never left my one PictureBox.

0 Votes 0 ·

1 Answer

ChristKingKennedy-5906 avatar image
0 Votes"
ChristKingKennedy-5906 answered ·

I changed my object to a panel and added two identical PictureBoxes to it.
by alternating which PictureBox is in front every time the mouse moves over a different 'object' (region on picturebox) the ToolTip detects a new Control (PictureBox in front of the previous one) it summons the ToolTip_Event.

problem solved.

·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.