开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜