怎样获得鼠标指针在屏幕上的位置?

libertysigil 2003-08-20 04:17:44
NET中有没有相关的类,或者是用API函数也行(最好有源码)。

怎样获得一个实例的句柄??

望详细告知!

谢谢!
...全文
68 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
bennycoy 2003-09-29
  • 打赏
  • 举报
回复
本窗体
libertysigil 2003-08-20
  • 打赏
  • 举报
回复
来不及回家试,所以有此一问:

private void Form1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
label1.Text = e.X.ToString();
label2.Text = e.Y.ToString();
}

标签显示的是鼠标光标在本窗体的相对坐标,还是在整个显示器的坐标?
libertysigil 2003-08-20
  • 打赏
  • 举报
回复
[DllImport("user32.dll")]
public static extern int GetCursorPos([MarshalAs(UnmanagedType.Struct)] ref POINTAPI lpPoint);

以上是函数的申明过程,那个参数POINTAPI lpPoint应该是什么?

我在调用函数的时候怎么出现:“未将对象的引用xx到对象的实例:
什么意思?
bborn 2003-08-20
  • 打赏
  • 举报
回复
不错 来学习
libertysigil 2003-08-20
  • 打赏
  • 举报
回复
怎样获得本模块实例的句柄?
dahuzizyd 2003-08-20
  • 打赏
  • 举报
回复
private void Form1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
label1.Text = e.X.ToString();
label2.Text = e.Y.ToString();
}
CMIC 2003-08-20
  • 打赏
  • 举报
回复
Control.MousePosition.X
Control.MousePosition.Y
Jim3 2003-08-20
  • 打赏
  • 举报
回复
System.Windows.Forms.Cursor.Position
csharplove 2003-08-20
  • 打赏
  • 举报
回复
在MOUSEMOVE事件中关联方法取得参数e.X,e.Y,即为位置,实例的句柄好像可以从INPTR属性获得
supergoalcn 2003-08-20
  • 打赏
  • 举报
回复
[DllImport("user32.dll")]
private static extern int GetCursorPos([MarshalAs(UnmanagedType.Struct)] ref POINTAPI lpPoint);

110,499

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧