C# – Load image from resources area of project in C#

cimageloadwinforms

I have an image in my project stored at Resources/myimage.jpg. How can I dynamically load this image into Bitmap object?

Best Answer

Are you using Windows Forms? If you've added the image using the Properties/Resources UI, you get access to the image from generated code, so you can simply do this:

var bmp = new Bitmap(WindowsFormsApplication1.Properties.Resources.myimage);