i tried the solution suggested here in delphi 2010 and XE7
How to use Animated Gif in a delphi form
both of them raise exception with the following message
"Exception class EInvalidCast with message 'Invalid class typecast'."
i tried the solution suggested here in delphi 2010 and XE7
How to use Animated Gif in a delphi form
both of them raise exception with the following message
"Exception class EInvalidCast with message 'Invalid class typecast'."
The code you refer to is:
(Image1.Picture.Graphic as TGIFImage).Animate := True;
The error message indicates that the checked as
cast fails. Which means that Image1.Picture.Graphic
does not descend from TGIFImage
. Whatever you put into the image control, it would appear not to be a GIF image.
I realise that this answer does not give you precise steps to a working program. However, I believe that the first step is to understand what the error message means. Once you understand that you know where to look for the solution.
The problem was from the components. In Delphi 2010 Graphic class was changed to TJvGIFImage by JEDI VCL and on XE7 Graphic class was changed to TdxSmartImage by devExpress.after I removed the related packages from install packages the problem solved.
Thanks for your help.