VB.NET 添加图像,使其显示在 My.Resources.TheImageName 下
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23048074/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
VB.NET Adding an image so that it shows up under My.Resources.TheImageName
提问by tmighty
Using VS2012, I would like to add an image to the My.Resources. namespace. I would like to draw this image to a PictureBox on the Paint event.
使用 VS2012,我想在 My.Resources 中添加一个图像。命名空间。我想将此图像绘制到 Paint 事件上的 PictureBox 中。
I did the following:
我做了以下事情:
I clicked "Add existing item", then I opened up the image. I clicked the image from the Solution Explorer and set the Build Task to "Embedded Resource".
我点击了“添加现有项目”,然后我打开了图片。我从解决方案资源管理器单击图像并将构建任务设置为“嵌入式资源”。
I saved the project and re-built it. But it still does not show up under My.Resources.
我保存了项目并重新构建了它。但它仍然没有显示在 My.Resources 下。
What did I do wrong, please?
请问我做错了什么?
Thank you for the help!
感谢您的帮助!
ps:
附:
I do not want to add it directly to "Resources.resx" (for example by clicking the "BackGroundImage" property of a form). I would prefer having the image in the solution explorer instead. I once experienced that VS2012 once damaged a file, and I had to rebuild the resource file. I would like to avoid it.
我不想将它直接添加到“Resources.resx”(例如通过单击表单的“BackGroundImage”属性)。我更喜欢在解决方案资源管理器中使用图像。我曾经经历过VS2012曾经损坏过一个文件,不得不重建资源文件。我想避免它。
回答by SLaks
You need to add the image to the Resources tab in Project Properties, not to the project directly.
您需要将图像添加到项目属性中的资源选项卡中,而不是直接添加到项目中。

