如何使Visual Studio识别多个项目资源文件 [英] How to get Visual Studio to recognize multiple project resource files

查看:158
本文介绍了如何使Visual Studio识别多个项目资源文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Visual Studio 2010中有一个Windows项目,其中所有图像都存储在Visual Studio为我创建的项目资源文件中.但是,它变得混乱了,如果可能的话,我想将图像分成多个资源文件.我创建了一个新的资源文件,但是当我去表单设计器并尝试更改图像时,Visual Studio无法识别它.可用的项目资源文件下出现的唯一文件是MyProject \ Resources.resx.我刚刚创建的那个不存在.

I have a Windows project in Visual Studio 2010 in which I store all images in the project's resource file that Visual Studio created for me. However, it's getting cluttered and I'd like to separate images into multiple resource files if possible. I created a new resource file, but Visual Studio doesn't recognize it when I go to the form designer and try to change an image. The only file that comes up under the Project resource files available are MyProject\Resources.resx. The one that I just created isn't there.

有人知道为什么它不显示吗?我尝试将资源放在My.Resources命名空间下,并更改命名空间,并且我也将其公开.它仍然没有显示.

Any idea why it doesn't show up? I tried putting the resource under the My.Resources namespace as well as change the namespace and I also made it public. It still doesn't show up.

推荐答案

一个项目只有一个默认资源文件.您可以随时将其他非默认资源文件添加到项目中.其他资源文件将不会放置在我的项目"文件夹中.它们将像其他文件一样简单地添加到项目中.

A project only has a single default resource file. You can add additional non-default resource files to the project at any time. Additional resources files will NOT be placed in the "My Project" folder. They will simply be added to the project like other files are.

您可以像引用其他资源一样引用这些新资源.代替通过"My.Resources."访问资源,您将在"My.Resources.[Resource File Name]"下找到其他资源文件.

You can refer to these new resources the same way you refer to others. Instead of accessing the resources through "My.Resources.", you will find the other resource files under "My.Resources.[Resource File Name]".

编辑:如果要从PictureBox控件中引用资源文件,则该文件必须位于项目的根目录中.

A resource file needs to be in the root of your project if you want to reference it from a PictureBox control.

希望对您有帮助.

这篇关于如何使Visual Studio识别多个项目资源文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆