unit Unit4;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Unit1, StdCtrls, ExtCtrls, jpeg;
type
TForm4 =
class(TForm)
ListBox1: TListBox;
Button1: TButton;
Image1: TImage;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form4: TForm4;
implementation
{$R *.dfm}
procedure ListAllPics(sPath:
string; List: TStrings);
var Rec: TSearchRec;
begin
List.BeginUpdate;
List.Clear;
if sPath[Length(sPath)] <> '
\'
then
sPath := sPath + '
\';
if FindFirst(sPath + '
*.*',faAnyfile,Rec) = 0
then
begin
repeat
if (AnsiLowerCase(ExtractFileExt(Rec.
Name)) = '
.jpeg')
or
(AnsiLowerCase(ExtractFileExt(Rec.
Name)) = '
.jpg')
or
(AnsiLowerCase(ExtractFileExt(Rec.
Name)) = '
.JPG')
or
(AnsiLowerCase(ExtractFileExt(Rec.
Name)) = '
.JPEG')
then
List.Add(Rec.
Name);
until FindNext(Rec) <> 0;
FindClose(Rec);
end;
List.EndUpdate;
end;
procedure TForm4.FormCreate(Sender: TObject);
begin
ListAllPics('
C:\Dokumente und Einstellungen\Sebastian\Desktop\Programmieren\Mysqlconnect\Pics\'+Form1.edID.text ,Listbox1.Items);
end;
procedure TForm4.Button1Click(Sender: TObject);
begin
image1.Picture.LoadFromFile('
C:\Dokumente und Einstellungen\Sebastian\Desktop\Programmieren\Mysqlconnect\Pics\'+Form1.edID.text +Listbox1.Items.Text);
end;
end.