请问如何实现象QQ那样自动隐藏窗体?鼠标感应窗体出现?
解决方案 »
- dbgrid点标题就可以排序,如何实现,最好说的仔细一点,谢谢了
- 2进制和16进制如何进行转换???
- 请问如何实现combobox控件的多选?多谢了
- 请教 fileread 函数的用法
- 请问如何对Excel文件中的两个页面(Sheet1、Sheet2)进行比较?
- 有介绍delphi关于类定义,使用的书籍,或文档吗?
- idhttp.get可以获得htm 文件,我现在想得到gif文件,怎么办?
- paradox表的Alpha字段类型不能作为查询字段?(救命,明天就要交了)
- 问个蠢问题... Too many actual parameters
- 用query查询的小问题。
- 我想在DELPHI里用对话框选取多个文件
- 求取汉字拼音的函数,谢谢了!
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls;type
TForm1 = class(TForm)
Timer1: TTimer;
Timer2: TTimer;
procedure Timer1Timer(Sender: TObject);
procedure Timer2Timer(Sender: TObject);
private
function GetFormNameAt ( X, Y : integer ) : string;
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}{ TForm1 }//×Ô¶¨Ò庯ÊýGetFormNameAt£¬»ñµÃÊó±êÕëָϴ°ÌåµÄName
function TForm1.GetFormNameAt(X, Y: integer): string;
var
P:TPoint;
W:TWinControl;
begin
P.X := X;
P.Y := Y;
W := FindVCLWindow(P); //µÃµ½Êó±êÖ¸ÕëϵÄVCL¿ÉÊÓ×é¼þ
if ( nil <> W ) then
begin
while w.Parent<>nil do //µ±WµÄÉϼ¶Parent²»Îª¿Õʱ¾Í¼ÌÐøÍùÉÏÕÒ
w:=w.Parent;
Result := W.Name;//×îºó·µ»Ø´°ÌåµÄÃû³ÆName
end
else
begin
Result := '';
end;end;procedure TForm1.Timer1Timer(Sender: TObject);
var
winPos:TPoint;
begin
if (form1.Top<=3) or (form1.Left>=screen.Width-form1.Width-3) or (form1.Left<=3) then //ÅДà
begin
GetCursorPos(winpos); //µÃµ½µ±Ç°Êó±êÖ¸ÕëµÄÔÚÆÁÄ»ÉϵÄ×ø±ê //µ±Êó±êÖ¸ÕëϵĴ°ÌåµÄNameµÈÓÚform1.nameʱ
if form1.name=GetFormNameAt(winpos.X,winpos.Y) then
{ÔÚ´ËÎÒÃÇ¿ÉÒÔΪform1È¡Ò»¸öÌرðµÄÃû³Æ£¬ÒÔ·ÀÓбðµÄ´°ÌåÃû³ÆÓëËüÏàͬ}
begin
form1.Timer2.Enabled:=false; //Í£ÓÃTimer2
form1.Top:=0; //form1µÄTopÓëÆÁÄ»¶ÔÆë
end
else
form1.Timer2.Enabled:=true; //¿ªÆôTimer2
end;
end;procedure TForm1.Timer2Timer(Sender: TObject);
begin
if form1.Top<=20 then
form1.Top:=-(form1.Height-5);//½«form1ÏòÉÏÒÆ£¬ÔÚÆÁÄ»ÉÏ·½Â¶³ö5ÏñËØ
end;
end.
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls;type
TForm1 = class(TForm)
Timer1: TTimer;
Timer2: TTimer;
procedure Timer1Timer(Sender: TObject);
procedure Timer2Timer(Sender: TObject);
private
function GetFormNameAt ( X, Y : integer ) : string;
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}{ TForm1 }function TForm1.GetFormNameAt(X, Y: integer): string;
var
P:TPoint;
W:TWinControl;
begin
P.X := X;
P.Y := Y;
W := FindVCLWindow(P);
if ( nil <> W ) then
begin
while w.Parent<>nil do
w:=w.Parent;
Result := W.Name;
end
else
begin
Result := '';
end;end;procedure TForm1.Timer1Timer(Sender: TObject);
var
winPos:TPoint;
begin
if (form1.Top<=3) or (form1.Left>=screen.Width-form1.Width-3) or (form1.Left<=3) then
begin
GetCursorPos(winpos);
if form1.name=GetFormNameAt(winpos.X,winpos.Y) then begin
form1.Timer2.Enabled:=false;
form1.Top:=0;
end
else
form1.Timer2.Enabled:=true;
end;
end;procedure TForm1.Timer2Timer(Sender: TObject);
begin
if form1.Top<=20 then
form1.Top:=-(form1.Height-5);
end;
end.