T
tom12345
Unregistered / Unconfirmed
GUEST, unregistred user!
unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls, ComCtrls, jpeg,shellapi; type TForm1 = class(TForm) Image11: TImage; Timer1: TTimer; Button1: TButton; Button2: TButton; procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); private { Private declarations } public { Public declarations } end;var Form1: TForm1; i:integer; TFrm :TForm;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject); // 自动创建 Formbegin For i:=1 to 3 do begin TFrm := TForm.Create(Self); with TFrm do begin Name:='Form1'+inttostr(i); Caption:='Form1'+inttostr(i); FormStyle:=fsStayOnTop; top:=120+i*30; Left:=200+i*30; Width := 250; Height := 200; end; TFrm.show; end;end;procedure TForm1.Button2Click(Sender: TObject); // 关闭 Formbegin for i := 0 to Screen.FormCount-1 do begin if Screen.Forms.Caption <> 'Form1' then begin Screen.Forms.Free; Screen.Forms.close; end; end;end;end.