![]() |
GIF in TImage
Wie kann ich eine GIF Datei (nur ein Bild - keine Animation) in eine TImage laden?
Kann man das? - Bei mir sagt Delphi, dass .gif ein unbekannter Dateientyp sei... :( |
Re: GIF in TImage
Hi,
bitte bemühe doch mal die DP-Suche, das hatten wir schon so oft. Stichworte: TGifImage oder JVGifAnimator. |
Re: GIF in TImage
Zitat:
|
Re: GIF in TImage
Zitat:
|
Re: GIF in TImage
Ich habe mehrere Suche gemacht aber nichts gefunden :(
Ich habe mehrere Beispiel-Programme heruntergeladen aber Delphi meldet jedesmal: Zitat:
|
Re: GIF in TImage
Liste der Anhänge anzeigen (Anzahl: 1)
habe Dir die pas mal angehängt
Grüße Klaus |
Re: GIF in TImage
Hi, suche mal bei
![]() Edit: Ja oder so. ^^ |
Re: GIF in TImage
:cheers: Danke :thumb:
:dp: :coder2: |
Re: GIF in TImage
Delphi-Quellcode:
Warum kann ich das Bild nicht sehen?
Form1.Height := 700;
Form1.Width := 300; Test := TGifImage.Create; Test.Height := 700; Test.Width := 300; Test.LoadFromFile('C:\test.gif'); - Ich habe GifImage.dcu in ...\Delphi6\Lib - Ich habe GifImage hinter USES geschrieben - Das Bild existiert - Das Bild hat genau die höhe und breite (700x300) |
Re: GIF in TImage
|
Re: GIF in TImage
Ich habe folgendes hinzugefügt:
Delphi-Quellcode:
und folgendes kam dabei raus:
Test.Parent := Form1;
Test.Show;
Delphi-Quellcode:
:wiejetzt:
[Fehler] Unit1.pas(31): Undefinierter Bezeichner: 'Parent'
[Fehler] Unit1.pas(32): Undefinierter Bezeichner: 'Show' |
Re: GIF in TImage
schau mal ob es so geht, ansosten stelle ich heute Abend noch was ein,
habe noch ein Beispiel zuhause.
Delphi-Quellcode:
HowTo aus der FAQ:
begin
gif := TGIFImage.Create; gif.LoadFromFile('c:\giftest.gif'); gif.Paint(Canvas,Form1.ClientRect,[goDirectDraw]); end; begin gif.Free; end; Zitat:
![]() Grüße Klaus |
Re: GIF in TImage
Zitat:
|
Re: GIF in TImage
Dieses TGifImage ist wie TBitmap und TJPEGImage ein nachfahre der Klasse TGraphic. Somit gibt es da kein Show, Parent etc. Allerdings sollte es möglich sein die Graphiken mit Assign untereinander zu zuweisen bzw. einem TImage zu zuweisen.
folgendes sollte auf jeden fall funktionieren:
Delphi-Quellcode:
var LGif: TGifImage;
begin LGif := TGifImage.Create; LGif.LoadFromFile('YourGifFile.Gif'); Image1.Picture.Graphic := LGif; LGif.Free; |
Re: GIF in TImage
Hhmm...
Delphi-Quellcode:
Dann kommt die Fehlermeldung: "Im Projeck Project1.exe ist eine Exception der Klasse EOSError aufgetreten. Meldung: 'Systemfehler. Code: 6. The handle is invalid'. Prozeß wurde angehalten. Mit Einzelne Anweisung oder Start fortsetzen." und der folgende Text wird blau markiert:
//in Unit1 - Form1 ist schon erstelt worden
var Form1: TForm1; Test: TGIFImage; implementation {$R *.dfm} procedure TForm1.FormActivate(Sender: TObject); begin Form1.Height := 231; Form1.Width := 165; Test := TGifImage.Create; Test.Height := 231; Test.Width := 165; Test.LoadFromFile('C:\gif\pic001.gif'); Test.Paint(Canvas,Form1.ClientRect,[goDirectDraw]); end;
Delphi-Quellcode:
Dieser Befehl befand sich in der GifUnit:
// Line: 12440
Result := nil;
Delphi-Quellcode:
Was habe ich (oder ist) falsch?
// Internal pain(t) routine used by Draw()
function TGIFImage.InternalPaint(Painter: PGifPainter; ACanvas: TCanvas; const Rect: TRect; Options: TGIFDrawOptions): TGIFPainter; begin if (Empty) or (Rect.Left >= Rect.Right) or (Rect.Top >= Rect.Bottom) then begin Result := nil; if (Painter <> nil) then Painter^ := Result; exit; end; // Draw in main thread if only one image if (Images.Count = 1) then Options := Options - [goAsync, goAnimate]; Result := TGIFPainter.CreateRef(Painter, self, ACanvas, Rect, Options); FPainters.Add(Result); Result.OnStartPaint := FOnStartPaint; Result.OnPaint := FOnPaint; Result.OnAfterPaint := FOnAfterPaint; Result.OnLoop := FOnLoop; Result.OnEndPaint := FOnEndPaint; if not(goAsync in Options) then begin // Run in main thread Result.Execute; // Note: Painter threads executing in the main thread are freed upon exit // from the Execute method, so no need to do it here. {hier kommt der Fehler!} Result := nil; if (Painter <> nil) then Painter^ := Result; end else Result.Priority := FThreadPriority; end; PS: Ich habe die GifUnit von hier: ![]() |
Re: GIF in TImage
Auch wenn ich folgendes schreibe passiert das gleiche... :?
Delphi-Quellcode:
:wiejetzt:
//Form1 ist schon erstellt worden
//Image1 ist schon erstellt worden und hat die richtige Größe schon var Form1: TForm1; Test: TGIFImage; implementation {$R *.dfm} procedure TForm1.FormActivate(Sender: TObject); begin Form1.Height := 231; Form1.Width := 165; Test := TGifImage.Create; Test.Height := 231; Test.Width := 165; Test.LoadFromFile('C:\gif\pic001.gif'); Test.Paint(Canvas,Form1.ClientRect,[goDirectDraw]); Image1.Picture.Graphic := Test; Test.Free; end; |
Re: GIF in TImage
Delphi-Quellcode:
schau mal bitte in die FAQ die ich hier in einem vorherigen Beitrag angehängt habe
uses
..TGifImage; ... var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.FormActivate(Sender: TObject); begin Form1.Height := 231; Form1.Width := 165; Image1.Picture.loadFromFile('c:\test.gif'); da ist all das erklärt. Grüße Klaus |
Re: GIF in TImage
Welchen Sinn hat es das du von dem GifImage die Größe mit "Test.Width" setzt wenn du anschließend LoadFromFile aufrufst? Durch das LoadFromFile wird das aktuell geladene Image entfernt und das aus der Datei geladen mit den entsprechenden Größen der Datei.
Hast du es eigentlich schon so versucht wie ich es gestern gepostet hab? Ich hab das Gefühl du hast das einfach ignoriert. Warum rufst du eigentlich "Test.Paint" auf? Ich dachte du willst das Bild in deinem TImage anzeigen. |
Re: GIF in TImage
:oops:
Ich hab das :oops: übersehen :pale: So löse ich das Problem:
Delphi-Quellcode:
uses {...} GifImage
procedure TForm1.FormActivate(Sender: TObject); begin Image1.Picture.LoadFromFile('C:\irgernd_ein_gif.gif'); end; |
Alle Zeitangaben in WEZ +1. Es ist jetzt 18:18 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz