Reputation: 119
In Delphi, the Timage
component can play an animated GIF image:
(Image1.Picture.Graphic as TGIFImage).Animate := True;
I convert this code to C++ equivalent:
((TGIFImage)Image1->Picture->Graphic)->Animate = true;
But I get an error:
[bcc32c Error] Unit1.cpp(60): no matching conversion for C-style cast from 'Vcl::Graphics::TGraphic *' to 'Vcl::Imaging::Gifimg::TGIFImage'
Vcl.Imaging.GIFImg.hpp(937): candidate constructor not viable: requires 0 arguments, but 1 was provided
What's the problem?
Upvotes: 0
Views: 499
Reputation: 596582
You are missing a *
in your type-cast:
((TGIFImage*)Image1->Picture->Graphic)->Animate = true;
^
And then, consider using a C++-style cast instead of a C-style cast:
static_cast<TGIFImage*>(Image1->Picture->Graphic)->Animate = true;
Upvotes: 3