//返回文件数目
function GetFileCount:integer;
//设置索引
procedure SetIndex(AIndex:integer);
//返回文件索引
function GetIndex:integer;
//返回当前完整文件名
function GetCurFullFileName:string;
//返回当前文件名
function GetCurFileName:string;
//返回下一个文件的文件名
function GetNextFileName:string;
//返回上一个文件的文件名
function GetPreFileName:string;
constructor Create;
destructor Destroy;override;
{ Public declarations }
end;
procedure JpgToBmp(const JpgFileName:string;AJpg:TJpegImage;Abmp:Tbitmap);
function IsJpgFile(const FileName:string):boolean;
const
RaisedPanel=1;
LoweredPanel=2;
var
Form1: TForm1;
ImageFileList:TImageFileList;
implementation
..
2. TImageFileList类具体实现如下:
--------------------------------------------------------------------------------
procedure TImageFileList.Add(FullFileName: string);
begin
FStrListFile.Add(FullFileName);
end;
--------------------------------------------------------------------------------
procedure TImageFileList.ChangeDir(dir: string);
var
SearchRec : TSearchRec;
Attr : integer;
Found : integer;
ExtFileName:string;
temstr:string;
begin
clear;
temstr:=dir+''\*.*'';
Attr := faAnyFile;
Found := FindFirst(temstr, Attr, SearchRec);
while Found = 0 do
begin
ExtFileName:=LowerCase(ExtractFileExt(SearchRec.Name));
if (ExtFileName=''.bmp'') or (ExtFileName=''.jpg'') or ((ExtFileName=''.jpeg'')) then
Add(dir+''\''+SearchRec.Name);
Found := FindNext(SearchRec);
end;
FindClose(SearchRec);
end;
--------------------------------------------------------------------------------
procedure TImageFileList.Clear;
begin
FStrListFile.Clear;
Findex:=-1;
end;
constructor TImageFileList.Create;
begin
FStrListFile:=TStringList.Create;
Findex:=-1;
end;
destructor TImageFileList.Destroy;
begin
FStrListFile.Free;
inherited;
end;
--------------------------------------------------------------------------------
function TImageFileList.GetCurFileName: string;
begin
result:=ExtractFileName(FStrListFile.Strings[Findex]);
end;
--------------------------------------------------------------------------------
function TImageFileList.GetCurFullFileName: string;
begin
result:=FStrListFile.Strings[Findex];
end;
--------------------------------------------------------------------------------
function TImageFileList.GetFileCount: integer;
begin
result:=FStrListFile.Count;
end;
----