c# – 关于resources.ApplyResources的System.Resources.Missing
这是我正在努力的代码:
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(EditorPane)); this.editorControl = new EditorControl(); resources.ApplyResources(this.editorControl,"editorControl",CultureInfo.CurrentUICulture); 当代码执行时,它抛出一个’System.Resources.MissingManifestResourceException’,所有错误消息都只是吼叫.
解决方法
对我来说,问题不是任何内部类定义.相反,问题源是在项目文件中,这花了我很长时间才发现.
这是我在项目文件中找到的: <EmbeddedResource Include="Main.resx" /> 这就是它必须: <EmbeddedResource Include="Main.resx"> <DependentUpon>Main.pas</DependentUpon> </EmbeddedResource> 如果没有列出这种依赖关系(我必须强调,我没有自己删除它 – 它是在某个阶段由MS Visual Studio完成的),必要的资源文件没有在编译例程中正确包含. 我希望这会有所帮助(并让其他人头疼)! (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |