2 years ago

#34978

test-img

Daniel D.

PictureBox plays gif twice

I'm trying to create add a super simple animated gif to a PictureBox control in WinForms.

And I'm having this super weird issue, that the gif runs twice, even though the gif is created to only run once.

This is the code. I tried adding it through Resources and the Design window, same result.

    private string gif = AppDomain.CurrentDomain.BaseDirectory + @"resources\lock.gif";

    public App()
    {
        InitializeComponent();
        // picturebox is set to disabled in properties
        pbxImage.ImageLocation = gif;
        pbxImage.Load();
        pbxImage.Enabled = true;
        
    }

I was thinking this would be super simple, but I can't for the life of me figure out why. I'm relatively new to WinForms so I'm guessing there's something I'm missing.

c#

winforms

animated-gif

0 Answers

Your Answer

Accepted video resources