Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Resources Bitmap file - does not contain a definition for Properties

I have the following code skeleton for a Grasshopper component I am making. Grasshopper 3D is a plugin for Rhino 3D, a piece of architecture software. It's a graphical programming language. Anyways, below is a sample Abstract Class, in which I am adding a Bitmap icon to the component.

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

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

With that said, I am getting the following error.

enter image description here

Here is my Resources folder:

enter image description here

like image 298
theGreenCabbage Avatar asked Oct 31 '25 01:10

theGreenCabbage


2 Answers

In my case, I was getting the same Error. What I was doing was I had been adding the image to Resources folder. It was adding it, right. but not the definition. So then I double clicked to the Resources.resx in Properties window. (not the resources folder) then I dragged and droped the image into the Resources.resx window. So That image is copied to resources folder and its definition as well . Hope it helps

like image 141
smoothumut Avatar answered Nov 01 '25 16:11

smoothumut


Wow I am silly. I overlooked that I used HM_SettingsForm twice.

Simply doing: return Properties.Resources.heatmap; worked.

like image 45
theGreenCabbage Avatar answered Nov 01 '25 16:11

theGreenCabbage



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!