我正在尝试将图片添加到一个按钮上(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));
}
}
有人能告诉我我做错了什么吗?