unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtDlgs, StdCtrls, ExtCtrls, jpeg;
type
TForm1 = class(TForm)
Button1: TButton;
OpenPictureDialog1: TOpenPictureDialog;
Timer1: TTimer;
Image1: TImage;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private
FPicFiles: TStrings;
FCurIndex: Integer;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
begin
if OpenPictureDialog1.Execute then
FPicFiles.Assign(OpenPictureDialog1.Files);
if FPicFiles.Count > 0 then
begin
FCurIndex := 0;
Timer1.Enabled := True;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
FPicFiles := TStringList.Create;
FCurIndex := -1;
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
FPicFiles.Free;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
if FCurIndex = FPicFiles.Count then FCurIndex := 0;
if FileExists(FPicFiles[FCurIndex]) then
Image1.Picture.LoadFromFile(FPicFiles[FCurIndex]);
Inc(FCurIndex);
end;
end.
没有特效处理。