Thema: Delphi GIF in TImage

Einzelnen Beitrag anzeigen

Benutzerbild von qb-tim
qb-tim

Registriert seit: 3. Mär 2006
Ort: Deutschland
280 Beiträge
 
Delphi 6 Professional
 
#15

Re: GIF in TImage

  Alt 11. Mai 2006, 13:51
Hhmm...

Delphi-Quellcode:
//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;
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:

Delphi-Quellcode:
// Line: 12440
Result := nil;
Dieser Befehl befand sich in der GifUnit:

Delphi-Quellcode:
// 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;
Was habe ich (oder ist) falsch?

PS: Ich habe die GifUnit von hier: http://www.torry.net/vcl/graphics/gif/gifimaged7c.zip
  Mit Zitat antworten Zitat