Einzelnen Beitrag anzeigen

juelin

Registriert seit: 9. Mai 2006
Ort: Mannheim
107 Beiträge
 
Delphi XE5 Professional
 
#4

AW: Stringgrid mit Bildern scrollen

  Alt 4. Mai 2019, 16:15
Problem gelöst.
Neuer Code:

procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
var r: TRect;
var u: integer;
var t: string;
var n: integer;
var m: integer;
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
for n:=1 to e1bildnum do
begin
t:=e1bilder[n];
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;
m:=0;
if StringGrid1.TopRow > 1 then
begin
m:=(StringGrid1.TopRow-1)*81;
end;
Rect.Top:=32+(n-1)*81-m;
Rect.Bottom:=Rect.Top+Image1.Picture.Height-1;
if Rect.Top < StringGrid1.Height then
begin
if Rect.Bottom > StringGrid1.Height then Rect.Bottom:=StringGrid1.Height;
StringGrid1.Canvas.CopyRect(Rect, Image1.Canvas, r);
end;
end;
end;
end;
end;
end;
end;
end;
Jürgen Linder
  Mit Zitat antworten Zitat