HOWTO: Load a bitmap from a resource

A

Alejandro Lapeyre

I am using a ImageList with a bitmap that contains all the images.

I am currently saving the bitmap in a PictureBox, and load into the
ImageList when the form loads.

How can I save the bitmap into a Resource and load it from there later?

Thanks.
Alejandro Lapeyre
 
K

Ken Tucker [MVP]

Hi,

Here is an example. I added the water lilies.jpg to my app and set
its
build action to embedded resource.


Dim bm As Bitmap

Dim myAsm As System.Reflection.Assembly =
System.Reflection.Assembly.GetExecutingAssembly()

bm = New Bitmap(myAsm.GetManifestResourceStream(Me.GetType, "Water
lilies.jpg"))



Ken

---------------
I am using a ImageList with a bitmap that contains all the images.

I am currently saving the bitmap in a PictureBox, and load into the
ImageList when the form loads.

How can I save the bitmap into a Resource and load it from there later?

Thanks.
Alejandro Lapeyre
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top