1 (edited by livexox 2018-08-09 16:30:52)

Topic: GIF Images not loading need help

Hello, I have the following script to load a GIF image but for some reason the image is not loading.  No error messages just the image doesn't load.

Please Help.

procedure frm_main_OnShow (Sender: String; Action: string);
var gif: TGIFImage;
var    ImageList: TImageList;
begin
     gif:=TGIFImage.Create();
     gif.LoadFromFile(ExtractFilePath(Application.ExeName)+'Images\gif.gif');
     gif.Width:=200;
     gif.Height:=200;
     gif.Animate:=True;
     gif.AnimationSpeed := 500;
     frm_main.Panel1.Canvas.Draw(0,0,gif);
     gif.free;
end;
Post's attachments

Attachment icon Gif Animation.zip 636.83 kb, 21 downloads since 2018-08-09 

Re: GIF Images not loading need help

Hello.


Place Image component to Panel1

procedure frm_main_OnShow (Sender: String; Action: string);
begin
     frm_main.Panel1.DoubleBuffered := True; // stops flickering
     frm_main.Image1.Picture.LoadFromFile(ExtractFilePath(Application.ExeName)+'Images\gif.gif');
     TGIFImage(frm_main.Image1.Picture.Graphic).Animate := True;// gets it goin'
     TGIFImage(frm_main.Image1.Picture.Graphic).AnimationSpeed:= 500;// adjust your speed
end;
Dmitry.

Re: GIF Images not loading need help

This worked. Thank you very much.

I have another question. is there  a way to prevent the application from freezing while performing a task?

For example, I'm trying to run a query at the same time display the GIF animation advising the user to wait. But i notice that sometimes the application will freeze (including the gif animation) until the task is completed.  Can you help?

Re: GIF Images not loading need help

Unfortunately it's not possible in MVD.

Dmitry.