How to embed graphics using a resource file

This sample project shows how to embed graphics using a resource file (instead of the method I showed in class, which was using an imageList object):

To embed bitmaps in a project, double-click the Resources.resx file in the Properties folder and add the bitmaps.  Make sure to set the Build Action property on each image file to Embedded.  To access the images in code, use statements like:

    pictureBox1.Image = Properties.Resources.happy;

Thanks to Brandon Rosenblum for this information.


Visitors: Hit Counter