解决方案 »

  1.   

    FMX和VCL一样,你能实现VCL的,FMX也可以
      

  2.   

    Firemonkey 貌似不能响应 Windows API 消息(WM_MOVE) ...
      

  3.   

    LZ的问题已经搞定了,LZ就看在我 半夜3点多 还在为你写代码的情况下,你把分给我吧   :D var
      Form1: TForm1;
      FormTop, FormLeft: Integer;
      IsFormMoved, IsStartHide, IsOnDeskTop: Boolean;
      CurPos: TPoint;implementation{$R *.fmx}procedure TForm1.FormCreate(Sender: TObject);
    begin
      FormTop := Top;
      FormLeft := Left;
      IsFormMoved := False;
      IsStartHide := False;
      IsOnDeskTop := False;
    end;//只需要一个TTimer控件就可以了
    procedure TForm1.tmrScanMoveTimer(Sender: TObject);
    begin
      //实时截获 鼠标的位置
      GetCursorPos(CurPos);  //判断窗口是否被移动了
      if (Left <> FormLeft) or (Top <> FormTop) then
        IsFormMoved := True
      else
        IsFormMoved := False;  //如果窗口移动了,就判断鼠标在那一刹那的位置。
      if IsFormMoved then
      begin
        if CurPos.Y <= 0 then  //判断鼠标是否到了 屏幕的顶端。
          IsStartHide := True
        else
        begin
          //在隐藏期间的窗口移动不作判断
          if (Top <> 0) and (Top <> (-Height+1)) then
            IsStartHide := False;
        end;
        FormLeft := Left;
        FormTop := Top;
      end;  //如果条件满足,窗口的停靠隐藏功能开始
      if IsStartHide then
      begin
        //判断鼠标在不在窗口中
        if PtInRect(Bounds(Left, Top, Width, Height), CurPos) then
          Top := 0
        else
          Top := -Height + 1;    IsOnDeskTop := True;
      end
      else
        IsOnDeskTop := False;  //经过我的实际应用,这段代码在遇到其它程序全屏时,也可见,比如看视频,打游戏。
      //另外 窗体的属性 “FormStyle” 也要设置为 【StayOnTop】
      if IsOnDeskTop then
      begin
        Self.Show;
        Self.BringToFront;
      end;
    end;