windows form top and mouse move
in my win form application when i will move my mouse from down to upward and after certain time i can not move my mouse more upward because at the top there is title bar. so how could i detect that my mouse touch the top end of the win form when i will move my mouse.
开发者_Python百科thanks
To determine whether your mouse is at the top edge of a form, simply compare the mouses location to the forms location.
Point mouseLocation = System.Windows.Forms.Control.MousePosition;
Point formLocation = form1.Location;
if (mouseLocation.Y == formLocation.Y)
{
System.Console.WriteLine("The mouse is at the top of the form.");
}
If I remember correctly, the position returned by the forms ".Location" method does NOT include the title bar.
精彩评论