Grasshopper component icon

Hi guys,

I use visual studio 2017 to develop a grasshopper component for rhino 6. Now I can’t add an icon to my component. It is easy to repeat my problem. I just use the project template to create a new component. After that I add one image file 24x24 and the same size icon image to the project.

Could anyone tell me how to get the icon for the component?
In the following sample snippet, I can see what I should do:

    /// <summary>
    /// Provides an Icon for every component that will be visible in the User Interface.
    /// Icons need to be 24x24 pixels.
    /// </summary>
    protected override System.Drawing.Bitmap Icon
    {
        get
        {
            // You can add image files to your project resources and access them like this:
            //return Resources.IconForThisComponent;
            return null;
        }
    }

But no way I can access the image file, I have tried Resource.iconfile or projectname.Resource.iconfile.

It works fine in vs 2022 for rhino 7, but it doesn’t work here.

thank you.

Regards
Eric

I load the rng,24/24 picture into Resources, and then apply.

thank you. I don’t know where my setting is wrong, I just can’t repeat what you did. It is vs 2017.

Thank you very much.

Here is my project:

Hi @smartunfold,

Try adding your icon as a project resource. For example:

– Dale