[DllImport("user32.dll")]
static extern bool TrackMouseEvent(ref TRACKMOUSEEVENT lpEventTrack);
None.
None.
Please add some!
// C#
// Sets the hover time to 3sec and resets MouseEnter so the cursor does not have to
// leave the control to hover again
[DllImport("user32.dll")]
static extern int TrackMouseEvent(ref TRACKMOUSEEVENT lpEventTrack);
[StructLayout(LayoutKind.Sequential)]
public struct TRACKMOUSEEVENT
{
public UInt32 cbSize;
public UInt32 dwFlags;
public IntPtr hWnd;
public UInt32 dwHoverTime;
public TRACKMOUSEEVENT(UInt32 dwFlags, IntPtr hWnd, UInt32 dwHoverTime)
{
this.cbSize = 16;
this.dwFlags = dwFlags;
this.hWnd = hWnd;
this.dwHoverTime = dwHoverTime;
}
}
protected override void OnMouseHover(EventArgs e)
{
OnMouseEnter(e);
base.OnMouseHover(e);
}
TRACKMOUSEEVENT tme; // Define it on the outside so you dont recreate it each time the mouse enters
protected override void OnMouseEnter(EventArgs e)
{
base.OnMouseEnter(e);
tme = new TRACKMOUSEEVENT();
tme.hWnd = this.Handle;
tme.cbSize = 16; // 4 bytes * 4 integers
tme.dwFlags = TME_HOVER;
tme.dwHoverTime = 1000 * 3;
TrackMouseEvent(ref tme);
}
The Control.MouseEnter, Control.MouseLeave and Control.MouseHover events.