从C#项目资源面积加载图像

问题描述:

我在储存在资源/ myimage.jpg我的项目的图像。我怎样才能动态地这个图像加载到Bitmap对象?

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

您使用Windows窗体?如果您添加使用属性/资源UI图像,您可以访问从产生code的形象,所以你可以简单地做到这一点:

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);