unit prog;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls, ExtDlgs, FileCtrl, jpeg;
type
Tfenster =
class(TForm)
back: TPanel;
oeffnen: TButton;
beenden: TButton;
open: TOpenPictureDialog;
laufwerk: TDriveComboBox;
ordner: TDirectoryListBox;
datei: TFileListBox;
procedure beendenClick(Sender: TObject);
procedure oeffnenClick(Sender: TObject);
procedure klicken(Sender: TObject);
procedure weg(Sender :TObject);
procedure FormCreate(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
fenster: Tfenster;
implementation
{$R *.dfm}
procedure Tfenster.beendenClick(Sender: TObject);
begin
close
end;
{grösseres vorschaubild erzeugen}
procedure Tfenster.klicken(Sender: TObject);
var w :
string; bild :TImage;
begin
if sender
is timage
then
begin
w := (sender
as timage).HelpKeyword;
end;
bild:=TImage.Create(back);
bild.Parent := back;
bild.Picture.LoadFromFile(w);
bild.IncrementalDisplay := true;
bild.Stretch := true;
bild.Top := 150;
bild.Left := 150;
if bild.Picture.Graphic.Height > bild.Picture.Graphic.Width
then
begin
bild.Height := 300;
bild.Width := 227;
end
else
begin
bild.Height := 227;
bild.Width := 300;
end;
bild.HelpKeyword := inttostr(bild.ComponentIndex);
bild.OnClick := weg;
end;
{vorschaubild entfernen}
procedure Tfenster.weg(Sender :TObject);
var b :integer;
begin
if sender
is timage
then
begin
b := strtoint((sender
as timage).HelpKeyword);
back.Components[b].destroy;
end;
end;
procedure Tfenster.oeffnenClick(Sender: TObject);
var img :TImage;
i,links,z,oben :integer;
begin
{vorhandene bilder entfernen}
for z := back.ComponentCount-1
downto 0
do
begin
back.Components[z].Free;
end;
{bilder öffnen und anordnen}
if open.Execute
then
begin
links := 5;
img.Top := 5;
oben := img.Top;
for i := 0
to open.Files.count-1
do
begin
img:=TImage.Create(back);
img.Parent := back;
img.Picture.LoadFromFile(open.Files[i]);
img.IncrementalDisplay := true;
img.Stretch := true;
img.Hide;
img.HelpKeyword := open.Files[i];
img.OnClick := klicken;
if links + 75 > back.Width
then
begin
links := 5;
oben := oben + 80;
end;
{bildgrösse und position anpassen}
if img.Picture.Graphic.Height > img.Picture.Graphic.Width
then
begin
img.Height := 70;
img.width := 53;
if i >= 1
then
begin
img.Left := links;
links := links + img.Width + 5;
img.Top := oben;
end
else
begin
img.Left := links;
links := links + img.Width + 5;
img.Top := oben;
end;
img.Transparent := true;
img.Show;
end
else
begin
img.Height := 53;
img.Width := 70;
if i >= 1
then
begin
img.Left := links;
links := links + img.Width + 5;
img.Top := oben;
end
else
begin
img.Left := links;
links := links + img.Width + 5;
img.Top := oben;
end;
img.Transparent := true;
img.Show;
end;
end;
end;
end;
{componenten anordnen}
procedure Tfenster.FormCreate(Sender: TObject);
begin
ordner.Left := screen.WorkAreaWidth - ordner.Width - datei.Width - 20;
datei.Left := screen.WorkAreaWidth - datei.Width - 20;
laufwerk.Left := datei.Left;
back.Top := oeffnen.Top + (oeffnen.Height *2);
ordner.Top := back.Top;
datei.Top := back.Top;
fenster.Width := screen.WorkAreaWidth;
fenster.Height := screen.WorkAreaHeight;
fenster.Left := 0;
fenster.top := 0;
back.Height := screen.WorkAreaHeight - (back.Top + 30);
back.Width := screen.WorkAreaWidth - ordner.Width - datei.Width - 28;
ordner.Height := back.Height;
datei.Height := ordner.Height;
beenden.Top := oeffnen.top;
end;
end.