我如何获得鼠标的位置? [英] How do i get the mouse position?

查看:137
本文介绍了我如何获得鼠标的位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

-edit-我不需要回答了,现在我计算的基础上鼠标按下的位置。

-edit- I dont need the answer anymore now that i calculate based on mousedown position.

基本上就这个问题好像EX中,y和e.Location.X,Y是相对的mousedown?我见过负值时,我还没有把它移到左/父picbox以上。

Basically in relation to this question It seems like e.X,y and e.Location.X,Y is relative to mousedown? I seen negative values when i havent moved it left/above the parent picbox.

因此​​,它似乎像值是相对于我的鼠标按下,但我需要的相对值,以父,因为我更新了左/上每一个事件和其他datat并且相对于mouseDown当打破我的code

So it seems like the values are relative to my mousedown, but i need values relative to the parent because i update the left/top every event and other datat and relative to mousedown is breaking my code.

推荐答案

你有没有尝试这样做(假设你的控件被命名为picbox)

Did you try to do this ( assuming your control is named picbox )

Point pt = picbox.PointToClient(point)

这篇关于我如何获得鼠标的位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆