C# Visual Studio using resource files
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>
精彩评论