fishhead fishhead - 10 days ago 5
C# Question

How do I retrieve an image from my resx file?

I have added an image to my form's resource file, myForm.resx, and I would like to use it in my code file, myForm.cs, but I am not entirely clear on how to get a handle to it.

Answer

See MSDN for ResourceManager

rm = new ResourceManager("Images", this.GetType().Assembly); 
pictureBox1.Image = (System.Drawing.Image)rm.GetObject("flag");
Comments