Ich habe den Tipp mit dem Bitmap mal umgesetzt:
Delphi-Quellcode:
type
TThumbnail = class(TPaintbox)
private
FFilename: String;
FPicture: TBitmap;
protected
procedure Paint; override;
public
property Filename: String read FFilename write FFilename;
property Picture: TBitmap read FPicture write FPicture;
end;
procedure TThumbnail.Paint;
begin
inherited;
if Assigned(Picture) then begin
Self.Canvas.Draw(0, 0, Picture);
end;
end;
Erzeugung:
Delphi-Quellcode:
Image := TGPImage.Create(f);
Thumbnail := Image.GetThumbnailImage(150, 150, nil, nil);
Bitmap := TBitmap.Create;
Bitmap.Height := 150;
Bitmap.Width := 150;
Graphics := TGPGraphics.Create(Bitmap.Canvas.Handle);
Graphics.DrawImage(Thumbnail, 0, 0, Thumbnail.Width, Thumbnail.Height);
OutputImage := TThumbnail.Create(Self);
OutputImage.AlignWithMargins := true;
OutputImage.Height := 150;
OutputImage.Width := 150;
OutputImage.Filename := f;
OutputImage.Cursor := crHandPoint;
OutputImage.OnClick := ThumbnailClick;
OutputImage.Picture := Bitmap;
OutputImage.Parent := flwpnlImageView;
Soweit ich sehen kann, funktioniert es! Ist das jetzt die beste Lösung?