interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls;
type
TForm1 = class(TForm)
// protected
Timer1: TTimer;
Button1: TButton;
procedure Timer1Timer(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
procedure WMsyscommand(var msg : Twmsyscommand);message wm_syscommand;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
{单击最小化隐藏窗体}
procedure Tform1.WMsyscommand(var msg : Twmsyscommand);
begin
if msg.CmdType = SC_MINIMIZE then
begin
Self.WindowState:=wsMinimized;
Self.Hide;
end
else inherited;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
Form1.Show;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
form1.Hide;
end;
end.
粘贴自: <http://www.cnpack.org/ >