【发布时间】:2011-10-25 04:30:25
【问题描述】:
我正在尝试将图像添加到按钮(C# Winform,VS2010)。我已经通过在 Resources.resx 文件中添加现有项目来添加资源。然后我将我的图像分配给按钮,一切看起来都很好。当我运行我的程序时,我得到:
An unhandled exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll
Additional information: Could not load file or assembly 'BmsReplayAnalysis.resources, Version=1.0.0.0, Culture=en-US, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
在这段代码中:
public static System.Drawing.Bitmap play1 {
get {
object obj = ResourceManager.GetObject("play1", resourceCulture); <-- DIES HERE
return ((System.Drawing.Bitmap)(obj));
}
}
谁能告诉我我做错了什么?
【问题讨论】:
-
好的,我知道发生了什么。我的代码中有一个 assemblyresolveEventHandler。我有一个 catch all else 声明,将 Myassembly.resources.dll 指向错误的位置
标签: c# visual-studio-2010 image embedded-resource