Ticket Q562011
Visible to All Users

DevEx components interfering with Delphi TImage.Picture property?

created 11 years ago

I know DevEx does not support animated GIFs (http://www.devexpress.com/Support/Center/Question/Details/Q522520) so I placed a Delphi TImage on my form, loaded an animated gif into the Picture property, then tried to start it with

(ImgProgress.Picture.Graphic as TGifImage).Animate := true;

which is the recommended way (http://stackoverflow.com/questions/14158186/animated-gif-in-delphi-xe-3-forms referencing http://stackoverflow.com/questions/9573572/how-to-use-animated-gif-in-a-delphi-form)

However this does not run, it gives an 'Invalid class typecast' at runtime.

When looking at the TImage in the Object Inspector, I notice that its Picture property indicates a type TdxSmartImage (and at runtime ImgProgress.Picture.Graphic.ClassName = 'TdxSmartImage').

That is one of your types (TdxSmartImage = class(TdxGPImage) in dxGDIPlusClasses.pas)!
Are the DevEx components interfering with the TImage.Picture?

[No sample code, this is easy to reproduce]

Comments (3)

    There is a far worse and lot more common side effect to the new "TdxSmartImage for everything" approach:
    Since v2013 vol 2.2 we have the following issue:
    At design time, it's not possible anymore to use "Color-Transparent" bitmaps (e.g. the common "Fuchsia background should be treated as transparent" approach).
    Affected are:
    - Editors for TBitmap (for example: TSpeedButton.Glyph, TToolButton.Glyph, …)
    - Editor for TImageList
    - Editor for TPicture (for example: TImage.Picture)
    (See attached screenshot for the results…)
    Only thing necessary for these effects: A registered DevExpress design time BPL (anyone will work…)
    TPicture additionally has the side effect to include dxGDIPlusClasses in the header and will then use TdxSmartImage even at runtime. It's not possible anymore to use a simple TBitmap anymore (neither TPngImage nor TJPEGImage) except by recompiling the DevExpress design time packages!

      An additional side effect is that GraphicFilter(TGraphic) to get a filter string for all known image format returns strings like "PNG from DevExpress"
      The user now has to decide between using "Portable Network Graphics (*.png)" and "PNG from DevExpress (*.png)"
      I've no idea what a user would think about "PNG from DevExpress (*.png)". Probably something like
      - "This is probably a special image format defined by DevExpress"
      - "What is the differences to the other PNG?"
      - "What is DevExpress?"
      Long story short: I doubt that such a dialog filter would pass user acceptance…

      DevExpress Support Team 11 years ago

        Hello Tom,
        I suggest that you try the hot fix from the Adding a BMP file to a TImageList object results in the "File format not supported by imagelist editor" error ticket. It should fix the transparency issue.

        Answers approved by DevExpress Support

        created 11 years ago (modified 11 years ago)

        Hello,
        Yes, our TdxSmartImage class is registered for GIF images in the RegisterAssistants procedure in the dxGDIPlusClasses unit. The solution from the RAD Studio 2009 and later - Make TdxPNGImage class registration optional for loading PNG images ticket can help you avoid this default behavior.

          Comments (2)

            It's not a nice solution for reasons already mentioned there: we would essentially have to do 2 runs for each upgrade. But assume we want animated gifs really bad:
            What would we lose?
            The remark by Serge in the discussions referenced over there ("Discontinuing this would be a breaking change for our users") makes me wonder what would break with this suggested patch…

            DevExpress Support Team 11 years ago

              Now we can suggest only the solution from the RAD Studio 2009 and later - Make TdxPNGImage class registration optional for loading PNG images thread.
              I believe that Serge's remark was related to legacy projects that use routines from our dxGDIPlusClasses unit.

              Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

              Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.