I'm trying to add two image files into the solution, so they will be compiled into the .exe, so I can load them right there instead of from an absolute path on the computer.
I believe I need to use resource files in Visual Studio, but I never have before. If I'm completely on the wrong track, please correct me.
Here's what I've done so far. In Visual Studio 2010 Solution Explorer, right click Properties → Open → Resources → Add Resource → Add Existing File...
So now I have both my images in the Properties → Resources tab. Now how do I get them back out in the C# code?
I'm using C#, Windows Forms and Visual Studio 2010.
PictureBox pic;
pic.Image = new Bitmap( /* What is the address now? */ );
You can get them like Properties.Resources.<name_of_your_resource>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With