开发者

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 PropertiesOpenResourcesAdd ResourceAdd开发者_高级运维 Existing File...

So now I have both my images in the PropertiesResources 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>

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜