How to get Visual Studio to recognize multiple pro

2020-04-05 08:45发布

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.

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.

Select Resource screen

1条回答
叼着烟拽天下
2楼-- · 2020-04-05 09:29

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.

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]".

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

I hope this helps you.

查看更多
登录 后发表回答