Completed
Last Updated: 20 Apr 2022 09:23 by ADMIN
Release R2 2022
Travis
Created on: 18 Apr 2022 13:18
Category: PictureBox
Type: Feature Request
0
RadPictureBox: Add support for animated gif files

Currently, RadPictureBox supports the gif format, but the animated gifs are not animated like the standard MS PictureBox.

Workaround: use a RadLabel to show the animated gif:

this.radLabel1.LabelElement.Image = Properties.Resources.giphy;

 

Attached Files:
1 comment
ADMIN
Dess | Tech Support Engineer, Principal
Posted on: 19 Apr 2022 07:50

Hello,

I would like to follow up with an alternative solution:

        public class CustomPictureBox : RadPictureBox
        {
            protected override RadPictureBoxElement CreateImageEditorElement()
            {
                return new CustomRadPictureBoxElement();
            }
        }

        public class CustomRadPictureBoxElement : RadPictureBoxElement
        {
            public override Image Image { get => GetPaintImage(); set => base.Image = value; }

            private Image GetPaintImage()
            {
                Image image = base.Image;
                if (image == null)
                {
                    return null;
                }
                Image paintImage = image;


                lock (image)
                {
                    this.AnimateImage(image, false);
                    ImageAnimator.UpdateFrames();

                    paintImage = image;
                    return paintImage;
                }
            }
            private void OnFrameChanged(object o, EventArgs e)
            {
                this.Invalidate();
            }
        }

 

Regards,
Dess | Tech Support Engineer, Principal
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.