开发者

.NET Custom Control Resources.resx

开发者 https://www.devze.com 2022-12-21 16:08 出处:网络
I have a C# custom control that loads images from Resources.resx.I was loading this resources into the Project\'s Resources and then accessing them like:

I have a C# custom control that loads images from Resources.resx. I was loading this resources into the Project's Resources and then accessing them like:

ProjectNamespace.Properties.Resources.resourcename;

This works for one project but now I want to use my control in multiple projects.

What's the best way to handle this? Load the resources into the controls .resx? How can I access them from there? Or sh开发者_Go百科ould I approach this completely differently?


It should work as is, even if your control is used from other projects.

The code generated by VS is a wrapper around the ResourceManager class, and it gives the assembly of your control as a constructor parameter. So, the ResourceManager always knows where to look for resources.

0

精彩评论

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