Reputation: 1255
I'm using C# and I want to display a tooltip in the center of the screen instead of using MessageBox
for some trivial tasks, such as showing exceptions and things like that.
How to do that? The problem is that tooltips always show near a control (like button1
, form1
, etc.).
Here is what I used:
ToolTip t = new ToolTip();
t.Show("show tooltip", this, 1500);
Upvotes: 4
Views: 1864
Reputation: 5433
Use the overloaded ToolTip.Show and set the Point where you want to show the tooltip. Example :
TooleTip t = new ToolTip();
t.Show("show tooltip", new Point(x, y), this, 1500);
Where x
and y
should be near the center of the form. Please note that the tooltip is shown relative to the form. So it won't be useful if the application is minimized. And like others said, its not a good idea after all. You could create some custom window that shows and hides after sometime.
See Form Fade In/Out Effect and Notification Window
Upvotes: 4