Ich will einfach nur ein Gif-Bild anzeigen lassen, komme aber mit den ganzen Eigenschaft nicht zurecht. Ich habe mir dazu die Hilfe folgender Unit bedient:
////////////////////////////////////////////////////////////////////////////////
// //
// Project: GIF Graphics Object //
// Module: gifimage //
// Description: TGraphic implementation of the GIF89a graphics format //
// Version: 2.2 //
// Release: 5 //
// Date: 23-MAY-1999 //
// Target: Win32, Delphi 2, 3, 4 & 5, C++ Builder 3 & 4 //
// Author(s): anme: Anders Melander,
anders@melander.dk //
// fila: Filip Larsen //
// rps: Reinier Sterkenburg //
// Copyright: (c) 1997-99 Anders Melander. //
// All rights reserved. //
// Formatting: 2 space indent, 8 space tabs, 80 columns. //
// //
////////////////////////////////////////////////////////////////////////////////
Ich wollte es mit dieser Variante machen:
"Call the Paint method of TGIFimage to create a TGIFPainter thread object, passing the destination canvas as a parameter."
Mein Problem ist, dass ich nicht weiß, wie ich meinen Dateipfad zuweise. Es gibt zwar folgende Funktion dafür:
Function Add(Source: TPersistent): integer;
Aber mein Dateipfad ist ja ein String und nicht vom Type Persistent.
Bin total konfus und komme nicht weiter.
Zum Quelletext unten, so läuft ihn der Debugger fehlerfrei durch, aber da ich ja keinen Pfad angeben kann, wird natürlich auch nichts angezeigt.
Vielleicht hilft das hier auch weiter:
Function Paint(ACanvas: TCanvas; const Rect: TRect; Options: TGIFDrawOptions): TGIFPainter;
Delphi-Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19:
| procedure TForm1.Shape1ContextPopup(Sender: TObject; MousePos: TPoint; var Handled: Boolean); var Ei : TGIFImage ; Rechteck : Trect; Pfad, Kurzpfad : String ; begin ; Pfad := 'C:\Projects\Animation\Bilder\Bild1.gif' ; Kurzpfad := '\Bilder\Bild1.gif' ;
Rechteck.TopLeft.X := 184 ; Rechteck.TopLeft.Y := 104 ; Rechteck.BottomRight.X := 200 ; Rechteck.BottomRight.Y := 120 ;
Ei.Create ; Ei.PaintStart ; Ei.Paint(Image2.Canvas,Rechteck,Ei.DrawOptions) ;
end; |