Completed
Last Updated: 23 Sep 2022 13:07 by ADMIN
Release R3 2022
Dean
Created on: 04 Aug 2022 07:50
Category: PictureBox
Type: Bug Report
1
RadPictureBox: Opening the control on different threads freeze the UI while showing GIF files
In this particular case, we have two forms showing RadPictureBox control with a GIF file. The second form is opened on a different thread which freezes the UI.
3 comments
ADMIN
Dinko | Tech Support Engineer
Posted on: 12 Aug 2022 12:46

Hi Dean,

Thank you for the provided details. I am happy to inform you that the status of the item is set to In Development. As soon as we are ready, we will specify in which version the fix will be available.

Regards,
Dinko
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Dean
Posted on: 12 Aug 2022 06:37
Sorry this can still fail. It looks like callback for each thread has to be different.......
Dean
Posted on: 12 Aug 2022 06:35

suggested work around is to clone image before locking and animating it - this removed possibility of deadlock. This should make all animations thread safe I assume!

e.g.

 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;

            Image aniimage = (Image)image.Clone();      //<1mS
            lock (aniimage)
            {
                this.AnimateImage(aniimage, false);     //< 1ms
                ImageAnimator.UpdateFrames();           //23mS for test GIF

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