Ich hab mir erlaubt das etwas lesbarer zu gestalten:
Delphi-Quellcode:
var e1bilder: array[1..99999] of string;
var e1bildnum: integer;
procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
var r: TRect;
var u: integer;
var t: string;
begin
if ((ARow = 0) and (ACol = 0)) then
begin
StringGrid1.RowHeights[ARow]:=32;
end else begin
if ((ARow > 0) and (ACol = 0)) then
begin
if ((e1bildnum > 0) and (ARow <= e1bildnum)) then
begin
t:=e1bilder[ARow];
u:=1;
if t <> '' then
begin
try
Image1.Picture.LoadFromFile(t);
except
u:=0;
end;
if u = 1 then
begin
r.Left:=0;
r.Right:=Image1.Picture.Width-1;
r.Top:=0;
r.Bottom:=Image1.Picture.Height-1;
Rect.Left:=0;
Rect.Right:=Image1.Picture.Width-1;
Rect.Top:=32+(ARow-1)*80+ARow;
Rect.Bottom:=Rect.Top+Image1.Picture.Height-1;
StringGrid1.Canvas.CopyRect(Rect, Image1.Canvas, r);
end;
end;
end;
end;
end;
end;