Image 来自资源文件的Visual Studio WInForms Designer图像
当我将Button控件的Image属性设置为指向项目资源文件中的图像时,当我编译并运行它时,它在应用程序中显示得很好,但是如果我尝试在设计器中加载表单,它会给我一条错误消息 类型“CoP.LAS.Properties.Resources”没有名为 “Adobe1” 虽然当我查看自动生成的资源文件时,它显然在那里:Image 来自资源文件的Visual Studio WInForms Designer图像,image,winforms,visual-studio-2015,resources,designer,Image,Winforms,Visual Studio 2015,Resources,Designer,当我将Button控件的Image属性设置为指向项目资源文件中的图像时,当我编译并运行它时,它在应用程序中显示得很好,但是如果我尝试在设计器中加载表单,它会给我一条错误消息 类型“CoP.LAS.Properties.Resources”没有名为 “Adobe1” 虽然当我查看自动生成的资源文件时,它显然在那里: namespace CoP.LAS.Properties { using System; /// <summary> /// A strongly-ty
namespace CoP.LAS.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute(
"System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
// Other stuff...
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap Adobe1 { // <--- HERE!!!
get {
object obj = ResourceManager.GetObject("Adobe1", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
名称空间CoP.LAS.Properties{
使用制度;
///
///强类型资源类,用于查找本地化字符串等。
///
//此类由StronglyTypedResourceBuilder自动生成
//通过诸如ResGen或Visual Studio之类的工具初始化。
//要添加或删除成员,请编辑.ResX文件,然后重新运行ResGen
//使用/str选项,或重建VS项目。
[全局::System.CodeDom.Compiler.GeneratedCodeAttribute(
“System.Resources.Tools.StronglyTypedResourceBuilder”,“4.0.0.0”)]
[全局::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[全局::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
内部班级资源{
//其他东西。。。
///
///查找System.Drawing.Bitmap类型的本地化资源。
///
internal static System.Drawing.Bitmap Adobe1{//我以前也有类似的东西,所以我添加了图像作为嵌入资源:是的,这就是我解决这个问题的方法,但我认为这是在每个使用资源的地方嵌入一次资源,显然是对存储的冗余浪费。