So I'm trying to create a tooltip at some point on the screen.
ToolTip tip = new ToolTip();
tip.Show("foobar", **IWin32Window window**, new Point(100, 100))
The problem is I don't know what to insert as the window
parameter in the above. My app runs entirely out of the system tray, and has no other GUI elements. It's called notifyIcon1
. That is created through Form1
. Neither of these values work when plugged in to tip.Show().
How can I generate a tooltip anywhere on my screen using only the system tray?
Thanks.
The IWin32Window interface is a simple interface that only provides a
IntPtr
property namedHandle
. Feasibly something like this should work:But it doesn't. It complains about a NullReferenceException and I haven't debugged further. This does work:
Although the position is relative to the current form. Maybe that will get you going in the right direction.
Edit: Even this doesn't work so I'm not sure if it's an issue with WindowWrapper (how?) or what:
Here you go, use a transparent, maximized form that you
BringToFront()
before showing theToolTip
Form1 Code:
Form1 Designer Code: So you can see the forms properties:
Joining late to the party:
In case you prefer/need to have WPF window:
Usage:
Result:
I didn't implement the Mouse leave event, since I've used short display duration.