unit U_popup;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls, ShellAPI;
type
Tfrm_popup = class(TForm)
Panel1: TPanel;
Timer1: TTimer;
Label1: TLabel;
Image1: TImage;
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure Timer1Timer(Sender: TObject);
procedure Label1Click(Sender: TObject);
procedure getTaskHeight;
private
aHeight: integer; //任务栏的高度
public
{ Public declarations }
end;
var
frm_popup: Tfrm_popup;
implementation
{$R *.dfm}
procedure Tfrm_popup.FormCreate(Sender: TObject);
begin
getTaskHeight;
frm_popup.left := Screen.Width - frm_popup.Width;
frm_popup.top := Screen.height - frm_popup.height - aHeight;
AnimateWindow(Self.Handle, 1250, AW_VER_NEGATIVE or AW_ACTIVATE);
end;
procedure Tfrm_popup.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Action := cafree;
end;
procedure Tfrm_popup.Timer1Timer(Sender: TObject);
begin
with frm_popup do begin
if height > 0 then begin
top := top + 5;
height := height - 5;
end else close;
end;
end;
procedure Tfrm_popup.Label1Click(Sender: TObject);
begin
Timer1.Enabled := true;
Timer1.OnTimer(Sender);
end;
procedure Tfrm_popup.getTaskHeight;
var
abd: TAppBarData;
begin
abd.cbSize := sizeof(abd);
SHAppBarMessage(ABM_GETTASKBARPOS, abd);
aHeight := abd.rc.Bottom - abd.rc.top;
end;
end.