views:

27

answers:

1

Hello.

I have added a simple .gif file into Resources folder in my project.

Now i have created a user control with pictureBox. How can i add the .gif to pictureBox.Image = new Bitmap (path).

What is the path in this case?

thanx !

A: 

I think you can do it in the following way:

// Create a MemoryStream from the .gif file resource
MemoryStream ms = new MemoryStream(YourApplicationName.Properties.Resources.GifFileName);

// Instantiate a new Bitmap using the created MemoryStream
pictureBox.Image = new Bitmap(ms);

Not completely sure if this works (cannot test it at the moment) but it should point you in the right direction.

Cloud
hmmm i will try it out, thanx !
no9
Let me know how it works out :)
Cloud

related questions