获取屏幕的坐标--GetCursorpos

 

GetCursorpos--是个WinAPI来的

 

 

procedure TMainForm.Timer1Timer(Sender: TObject);
var
  p1,p2:Tpoint;
begin
  GetCursorpos(p1);//获取屏幕坐标
  Label1.Caption := ' 屏幕坐标:X ' + IntToStr(P1.X) + ' Y ' + Inttostr(P1.Y);
  p2:=ScreenToclient(p1);
  Label2.Caption := ' 窗体坐标:X ' + IntToStr(P2.X) + ' Y ' + Inttostr(p2.Y);
end;

你可能感兴趣的:(Cursor)