Click here to Skip to main content
15,941,828 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to insert GIF file in windows Form

1 solution

PictureBox class in System.Windows.Forms namespace will resolve this issue. Here is the sample code:

private Bitmap MyImage ;
public void ShowMyImage(String fileToDisplay, int xSize, int ySize)
   // Sets up an image object to be displayed.
   if (MyImage != null)

   // Stretches the image to fit the pictureBox.
   pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage ;
   MyImage = new Bitmap(fileToDisplay);
   pictureBox1.ClientSize = new Size(xSize, ySize);
   pictureBox1.Image = (Image) MyImage ;
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900