【问题标题】:Resources Bitmap file - does not contain a definition for Properties资源位图文件 - 不包含属性的定义
【发布时间】:2017-09-19 21:08:53
【问题描述】:

我正在制作的 Grasshopper 组件具有以下代码框架。 Grasshopper 3D 是 Rhino 3D 的一个插件,一个建筑软件。它是一种图形编程语言。无论如何,下面是一个示例抽象类,我在其中向组件添加了一个位图图标。

namespace HM_SettingsForm 
{
    public class HM_Settings : GH_Component
    {
        // Misc code

        protected override Bitmap Icon
        {
            get
            {
                return HM_SettingsForm.Properties.Resources.heatmap;
            }
        }
        // Misc code
    }
}

话虽如此,我收到以下错误。

这是我的资源文件夹:

【问题讨论】:

    标签: c# bitmap resources


    【解决方案1】:

    就我而言,我遇到了同样的错误。我正在做的是将图像添加到资源文件夹中。它正在添加它,对。但不是定义。然后我双击属性窗口中的 Resources.resx。 (不是资源文件夹)然后我将图像拖放到 Resources.resx 窗口中。所以该图像也被复制到资源文件夹及其定义中。 希望对你有帮助

    【讨论】:

      【解决方案2】:

      哇,我真傻。我忽略了我使用了两次HM_SettingsForm

      只需做:return Properties.Resources.heatmap; 工作。

      【讨论】:

        【解决方案3】:

        遇到了同样的问题,通过引用此图像(在我的情况下为 ToolStripMenuImage)解决了它:

        this.tsm.Image = global::ASIM_Formatieren.Properties.Resources.icon_help;
        

        到这里

        this.tsm.Image = (System.Drawing.Bitmap)Properties.Resources.ResourceManager.GetObject("icon_help");
        

        【讨论】:

          猜你喜欢
          • 2021-07-26
          • 2016-10-09
          • 1970-01-01
          • 2016-01-18
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多