I have Form subclass with handlers for MouseHover
and MouseLeave
. When the pointer is on the background of the window, the events work fine, but when the pointer moves onto a control inside the window, it causes a MouseLeave
event.
Is there anyway to have an event covering the whole window.
(.NET 2.0, Visual Studio 2005, Windows XP.)
Ovveride the MouseLeave event to not trigger so long as the mouse enters a child control
protected override void OnMouseLeave(EventArgs e)
{
if (this.ClientRectangle.Contains(this.PointToClient(Control.MousePosition)))
return;
else
{
base.OnMouseLeave(e);
}
}