AnimationEnable Example for Delphi

This example loads and plays an animated file. It assumes that the LEAD control has already been sized to the aspect ratio of the image.

var
   RasterIO: LEADRasterIO;
   sRet: SmallInt;
begin

   RasterIO:= CreateComObject (CLASS_LEADRasterIO) as LEADRasterIO;

   //Load all pages of a GIF file.
   RasterIO.Load ( LEADRasterView1.Raster, 'd:\pictures\eye.gif', 0, 1, -1 ) ;
   //Set properties for a scaled animation.
   LEADRasterView1.AutoRepaint := True;
   LEADRasterView1.AutoSetRects := False;
   //Set the image display size to match the LEAD control.
   LEADRasterView1.SetDstRect ( 0, 0,
                LEADRasterView1.ScaleWidth,
                LEADRasterView1.ScaleHeight,
                sRet );
   LEADRasterView1.SetDstClipRect ( 0, 0,
                LEADRasterView1.ScaleWidth,
                LEADRasterView1.ScaleHeight,
                sRet ) ;
   //Allow a continuous loop.
   LEADRasterView1.AnimationLoop := True;
   //Start the animation.
   LEADRasterView1.AnimationEnable := True;
end;