列出当前项目中的资源
从 UITypeEditor 加载的表单中,如何获取当前项目中的资源列表?
我尝试过使用 GetManifestResourceNames() ,但这为我提供了创建用户控件的项目的资源列表,而不是我使用的投影中的资源列表 用户控件。
我猜我需要能够获取根容器所在项目的程序集名称,以便我可以创建正确的资源管理器?
From a form loaded from a UITypeEditor, how do I get a list of resources in the current project?
I've tried using GetManifestResourceNames() but that gives me a list of resources for the project the user control was created in, instead of the a list of resources in the projected I'm using the user control in.
I'm guessing I need to be able to get the the assembly name of the project in which the root container resides so that I can create the correct resource manager?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您想获取给定实例的类所属的程序集,请尝试以下操作
如果您知道类型,只需执行此操作
或者,您可以在用户控件中尝试此操作
最后一个示例将返回方法的程序集调用当前正在执行的方法。也许您可以将程序集引用存储为用户控件中的成员变量,并在用户控件的构造函数中分配它。这将为您提供对实例化 UserControl 的程序集的引用
If you want to get the assembly that a class of a given instance belongs to, try the following
If you know the type, simply do this
Or, you can try this, in your user control
The last example will return the Assembly of the method that invoked the currently executing method. Perhaps you could store an Assembly reference as a member variable in your UserControl and assign it in your UserControl's constructor. That would give you a reference to the assembly that instantiates your UserControl