c# - 找不到适合指定区域性的任何资源(资源文件中的 C# WinForm 图像)

标签 c# winforms

我将三个图像添加到名为 Resource1.resx 的文件中。我还添加了一个字符串只是为了测试目的。我在 GetString 或 GetObject(image-name) 上收到此错误。

{"Could not find any resources appropriate for the specified culture or the neutral culture. Make sure \"Resource1.resources\" was correctly embedded or linked into assembly \"TFBIC.RCT.Monitor\" at compile time, or that all the satellite assemblies required are loadable and fully signed."}

    // 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");  

我的表单是我项目中的第一个类(我已经看到那个错误)。
我为我的项目分配了一个强键,但没有用。
不确定还能尝试什么。

最佳答案

您是否记得在引用资源时包含默认命名空间/文件夹?

ResourceManager rm = new ResourceManager("DefaultNamespace.Folder.ResourceName");

如果您不确定名称是否正确,请在 Reflector 中加载程序集并向下浏览以查看它是什么。

关于c# - 找不到适合指定区域性的任何资源(资源文件中的 C# WinForm 图像),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1923953/

相关文章:

c# - 带有 UDPClient.EndReceive 和 ref 远程端点参数的 Observable.FromAsyncPattern

c# - 是否可以在不设置 C# 中数组大小的情况下将输入循环输入到数组中?

c# - 如何在 wp7 中显示来自网络的图像?

c# - 为什么return后代码还在运行

.net - 这是什么控件?组框与否!

c# - 在 Combobox 中使用字典作为 ValueMember

c# - Web 角色部署期间缺少 Microsoft.WindowsAzure.Diagnostics

c# - 获取 DER 编码的公钥

c# - 在 .NET Windows 窗体中,如何在两个 EXE 或应用程序之间发送数据?

c# - 动态生成 SQL 查询