C# 如何在某个控件上获取鼠标位置
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/465545/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to get mouse position over a certain control
提问by Dustin Brooks
Windows Form
I'm using the DragOver event on a layoutpanel and the DragEventArgs returns the X/Y coordinates of the mouse in relation to the screen. I know there is a function to translate this in to the position of the mouse over the control, but I'm having difficulty locating it.
Windows 窗体
我在布局面板上使用 DragOver 事件,而 DragEventArgs 返回鼠标相对于屏幕的 X/Y 坐标。我知道有一个函数可以将其转换为鼠标在控件上的位置,但是我很难找到它。