delphi 获取窗体坐标触发事件
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TForm1 = class(TForm)
Timer1: TTimer;
Edit1: TEdit;
Label1: TLabel;
Memo1: TMemo;
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Timer1Timer(Sender: TObject);
var
pt: TPoint;
begin
GetCursorPos(pt);
pt := ScreenToClient(pt);
edit1.Text := Format('%d;%d', [pt.X,pt.Y]);
if Format('%d;%d', [pt.X,pt.Y])=Format('%d;%d', [90,66]) then
begin
showmessage('³É¹¦£¡');
end;
end;
end.