The IWin32Window interface is a simple interface that provides only the IntPtr property named Handle . Perhaps something like this should work:
using System; using System.Runtime.InteropServices; using System.Windows.Forms; namespace SO_ToolTip { public partial class Form1 : Form { [DllImport("user32.dll")] public static extern IntPtr GetDesktopWindow(); public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { WindowWrapper windowWrapper = new WindowWrapper(GetDesktopWindow()); ToolTip toolTip = new ToolTip(); toolTip.Show("Blah blah... Blah blah... Blah blah...", windowWrapper, 1, 1, 10000); } } public class WindowWrapper : IWin32Window { public WindowWrapper(IntPtr handle) { Handle = handle; } public IntPtr Handle { get; protected set; } } }
But this is not so. It complains about a NullReferenceException, and I haven't debugged it yet. It works:
... private void button1_Click(object sender, EventArgs e) { ToolTip toolTip = new ToolTip(); toolTip.Show("Blah blah... Blah blah... Blah blah...", this, 1, 1, 10000); } ...
Although the position refers to the current form. Perhaps this will help you move in the right direction.
Edit: Even this does not work, so I'm not sure if this is a problem with WindowWrapper (how?) Or what:
... private void button1_Click(object sender, EventArgs e) { WindowWrapper windowWrapper = new WindowWrapper(this.Handle); ToolTip toolTip = new ToolTip(); toolTip.Show("Blah blah... Blah blah... Blah blah...", windowWrapper, 1, 1, 10000); } ...
Here you go, use the transparent, maximized form that you BringToFront() before showing the ToolTip
Form Code:
using System; using System.Windows.Forms; namespace SO_ToolTip { public partial class Form1 : Form { Random _Random = new Random(); ToolTip _ToolTip = new ToolTip(); public Form1() { InitializeComponent(); } private void timer1_Tick(object sender, EventArgs e) { BringToFront(); _ToolTip.Show("Blah blah... Blah blah... Blah blah...", this, _Random.Next(0, Width), _Random.Next(0, Height), 10000); } } }
Constructor Code Form1:. You can see the properties of the forms:
namespace SO_ToolTip { partial class Form1 {