To display an animated image on your Form,do the following;
1.)Drop a PictureBox on your Form.
2.)In the Properties Window of designer,change the image property so it contains the path to your image.
3.)Resize it as per your needs.
That's it,now try to run the project,if no exception is thrown you will see your image animating in the PictureBox.
Anytime during the course of execution of the project if you want to change the image,use the statement below;
pictureBox1.Load("Path to a new image");//Assuming you haven't renamed the PictureBox.
Additionally,if you would like to do the stuff by hand,read along;
private void DisplayImage()
{
PictureBox pictureBox1=new PictureBox();
pictureBox1.Location=new Point(Use appropriate values to place the control);
this.Controls.Add(pictureBox1);
pictureBox1.Load("Path to a image to display");
}
When you don't want the PictureBox to be shown,set its visible property to false just like other users said,in this way;
pictureBox1.Visible=false;
and to get it back use the code below;
pictureBox1.Visible=true;
Update :
To display the image only for 5 seconds do this;
Drop a Timer on your Form.
Set its Interval property to 5000 Milliseconds.
Create a new Event for its Tick Event (locate Tick event in Events Window and double click it).
Next modify DisplayImage() so it looks like :
private void DisplayImage()
{
timer1.Start();
PictureBox pictureBox1=new PictureBox();
pictureBox1.Location=new Point(Use appropriate values to place the control);
this.Controls.Add(pictureBox1);
pictureBox1.Load("Path to a image to display");
}
Next define an integer field(outside all functions) named count,like this;
private int count=0;
Now modify timer1_Tick() event so it looks like below;
private void timer1_Tick(object sender, EventArgs e)
{
count++;
if (count == 5)
{
SourcePictureBox.Image = null;
count = 0;
}
}
That should do the job.Anything else,please let me know.