Reputation: 89
I want to show the tooltip just beneath the cursor position, and not in its default position (its show the tooltip behind the cursor). How can I set its position?
I did nothing, but added a tooltip in the form and wrote the following code to display it on button hover:
toolTip1.Show("Text", button1);
Upvotes: 1
Views: 1860
Reputation: 684
Use this overload of the ToolTip.Show()
method:
public void Show(
string text,
IWin32Window window,
Point point
)
Your code then becomes:
Point pos = new Point(Cursor.Position.X, Cursor.Position.Y - 1); //Change this to whatever you want
toolTip1.Show("Text", button1, pos);
Upvotes: 4