0

In the project sources i added the animated gif a existing file : On the right bottom i see the type if bitmap and not gif.

animated gif

In the form code :

using Capture_Screen.Properties;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Test
{
    public partial class SettingsForm : Form
    {
        public SettingsForm()
        {
            InitializeComponent();

            pictureBox1.Image = Resources.Settings;
        }

        private void SettingsForm_Load(object sender, EventArgs e)
        {

        }
    }
}

The result when running the application in the pictureBox i see some brown color instead playing the animated gif :

brown color in picturebox instead playing the animated gif.

Sharo SA
  • 131
  • 1
  • 7
  • Does this answer your question? [Can a PictureBox show animated GIF in Windows Application?](https://stackoverflow.com/questions/13485477/can-a-picturebox-show-animated-gif-in-windows-application) – cemahseri Jun 28 '22 at 11:59
  • Looks like a very large image, change the SizeMode property. – Hans Passant Jun 28 '22 at 12:36
  • `pictureBox1.SizeMode = PictureBoxSizeMode.Zoom;` -- If the animation is supposed to be that small, you could resize the GIF (using a dedicated tool), so it requires less memory space (when the frames are expanded, the animation occupies way more than 1.8 MB) – Jimi Jun 28 '22 at 12:58

1 Answers1

0

this works for me

private Bitmap gifImage;

pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage ;
gifImage = new Bitmap(pathofImage);
pictureBox1.Image = (Image) gifImage;
Majed Jaber
  • 197
  • 1
  • 7
  • it's showing it as bitmap not animated gif, the file on the hard disk is gif type animated gif size 1.8MB when i added it to the Resources as existing file the format is bitmap and with your code i see it as still image. i want it to be show as animated gif and that the animated gif file will be in the Resources and not from a file on the hard disk. – Sharo SA Jun 28 '22 at 12:42