如何取得当前鼠标在屏幕中的位置?

getdelphi 2003-09-14 11:03:54
如何取得当前鼠标在屏幕中的位置?
...全文
111 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
tjff2000 2003-09-14
  • 打赏
  • 举报
回复
var point:Tpoint;
begin
GetCursorPos(point);
Edit1.Text:=inttostr(point.x);
end;
getdelphi 2003-09-14
  • 打赏
  • 举报
回复
能不能给个例子?
sixgj 2003-09-14
  • 打赏
  • 举报
回复

需要用到API函数 getcursorpos();
tjff2000 2003-09-14
  • 打赏
  • 举报
回复
getcursorpos();
tohail 2003-09-14
  • 打赏
  • 举报
回复
在 OnMouseMove事件中
procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
var
MyPoint:Tpoint;
begin
GetCursorPos(MyPoint); //获取屏幕坐标
X:=MyPoint.X; //重定位X坐标值
Y:=MyPoint.Y; //重定位Y坐标值
Label1.Caption:='X: '+IntToStr(X)+' Y: '+ IntToStr(Y); //将坐标显示出来
end;
dyf2001 2003-09-14
  • 打赏
  • 举报
回复
呵呵,是呀
Mouse.CursorPos.X
Mouse.CursorPos.Y
xudong51 2003-09-14
  • 打赏
  • 举报
回复
楼上的方法最方便
FrameSniper 2003-09-14
  • 打赏
  • 举报
回复
直接用全局变量Mouse的属性CursorPos!
大地精灵 2003-09-14
  • 打赏
  • 举报
回复
var
x:integer;
begin
x := GetCursorPos(point).x;
end;

5,386

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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