Einzelnen Beitrag anzeigen

moperswings

Registriert seit: 27. Mai 2004
Ort: Bad Sooden-Allendorf
240 Beiträge
 
Delphi 6 Professional
 
#6

Re: Einer FileListBox mehrere FileEdits zuweisen

  Alt 9. Apr 2007, 11:01
Meine (vorerst primitive) Beispiellösung:
Was ich noch nicht weiss:
Wie könnte ich mir die Buttons ersparen und die Bilder direkt übergeben?
Delphi-Quellcode:
var
        Form1: TForm1;
        pic_a, pic_b, pic_c, pic_d: string;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
        WebBrowser1.Navigate('d:\image9\daten.html');
        WebBrowser1.Update;
end;

procedure TForm1.Button1Click(Sender: TObject);
var
        a1, a2: string;
begin
        Image1.Picture.LoadFromFile(FileListBox1.FileName);
        a1 := 'images\';
        a2 := Edit1.Text;
        pic_a := a1 + a2;
end;

procedure TForm1.Button2Click(Sender: TObject);
var
        b1, b2: string;
begin
        Image2.Picture.LoadFromFile(FileListBox1.FileName);
        b1 := 'images\';
        b2 := Edit1.Text;
        pic_b := b1 + b2;
end;

procedure TForm1.Button3Click(Sender: TObject);
var
        c1, c2: string;
begin
        Image3.Picture.LoadFromFile(FileListBox1.FileName);
        c1 := 'images\';
        c2 := Edit1.Text;
        pic_c := c1 + c2;
end;

procedure TForm1.Button4Click(Sender: TObject);
var
        d1, d2: string;
begin
        Image4.Picture.LoadFromFile(FileListBox1.FileName);
        d1 := 'images\';
        d2 := Edit1.Text;
        pic_d := d1 + d2;
end;

procedure TForm1.Button5Click(Sender: TObject);
var
        f: textfile;
        dateiname: string;
        table, table_start, td, table_end: string;
        img_start, img_end: string;
begin
        dateiname := 'd:\image9\daten.html';
        AssignFile(f, dateiname);
        {$i-}
        rewrite(f);
        {$i+}
        If IOResult <> 0 then begin ShowMessage('Fehler');
        Exit;
        end;

        table_start := '<table><tr><td>';
        td := '</td><td>';
        table_end := '</td></tr></table>';
        img_start := '<img src="';
        img_end := '" />';

        table := table_start +
                   img_start + pic_a + img_end + td +
                   img_start + pic_b + img_end + td +
                   img_start + pic_c + img_end + td +
                   img_start + pic_d + img_end +
                 table_end;

        Writeln(f, table);
        closefile(f);
        WebBrowser1.Update;
end;
end.
  Mit Zitat antworten Zitat