[范例] Firemonkey TForm 实现 OnMouseLeave 事件 (適用 Win & OS X)

在 Firemonkey 的 TForm 并没有提供 OnMouseLeave 的事件,不过可以透过 OnMouseMove 来达到相同效果,请见代码:

uses  FMX.Consts;

procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Single);
begin
  if (Shift = []) and (X = FormUseDefaultPosition) and (Y = FormUseDefaultPosition) then
  begin
    // ...当鼠标移开 Form,做点什么...
  end;
end;

 

posted @ 2016-04-11 21:36  龟山Aone  阅读(566)  评论(0编辑  收藏  举报