【发布时间】:2009-12-17 19:19:29
【问题描述】:
我将三个图像添加到一个名为 Resource1.resx 的文件中。我还添加了一个字符串仅用于测试目的。我在 GetString 或 GetObject(image-name) 上收到此错误。
{"找不到任何资源 适用于指定的文化 或中立文化。确保 \"Resource1.resources\" 是正确的 嵌入或链接到程序集中 \"TFBIC.RCT.Monitor\" 在编译时, 或者所有的卫星组件 required 是可加载且完全的 签名。"}
// get initial images
ResourceManager rm = new ResourceManager(
"Resource1",System.Reflection.Assembly.GetExecutingAssembly());
CultureInfo ci = Thread.CurrentThread.CurrentCulture;
string strTest = rm.GetString("String1"); // just testing
Bitmap bmCircleGreen = (Bitmap)rm.GetObject("circleGreen");
Bitmap bmCircleYellow = (Bitmap)rm.GetObject("circleYellow");
Bitmap bmCircleRed = (Bitmap)rm.GetObject("circleRed");
我的表单是我项目中的第一个类(我已经看到了那个错误)。
我为我的项目分配了一个强键无济于事。
不知道还能尝试什么。
【问题讨论】:
-
这个answer为我解决了这个问题!
GetGlobalResourceObject