Firemonkey下怎么实现像QQ一样靠边自动隐藏? firemonkeyqq 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 FMX和VCL一样,你能实现VCL的,FMX也可以 Firemonkey 貌似不能响应 Windows API 消息(WM_MOVE) ... 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; image读入jpg文件时的错误? 找出某个路径下的所有子目录和文件? ziptv如何实现增加文件说明/备注 简单问题,帮帮忙啊,在线等... 如何更改form的caption的颜色? 怎样在一过程中使用ADOconnection... 如何在DELPHI中得到SQL-SERVER当前的日期时间 如何显示DBGrid 某条记录的某一列的颜色和网格边框变色 combobox 问题 一个关于字符串的问题? 关于Windows2008下Delphi不能捕获异常的问题 法检查通过,但运行时出出现SQL错误提示,请高手指点一下.
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;