Icons (resources) in Sharp Develop

I’ve finally figured out how to get icons into my SharpDevelop grasshopper components. I had been struggling to understand this tutorial http://wiki.sharpdevelop.net/UsingResources.ashx, but I think I’ve got a good understanding of how to make it work (dont yet know exactly why). So far I got it to work with a bitmap. Not sure if there will be any changes to be made with other image file types.

1. First add a reference to System.Drawing (this is what allows you to add images)

2. Add a resource fill by clicking Projects > Add > New Item and select Misc > Empty Resource File

3. Go to your new empty resource file and right click in on one of the blank cells and select “Add Files” and then add your files in the browser

4. Go to the properties of your resource file in the project tree select “ResXFileCodeGenerator” for Custom Tool

5. Right click on your resource file and select “Execute Custom Tool” (this generates a designer.vb file which does all the hard work for you)

6. For the Propery Internal_Icon, Return a reference to the image with the Name of the resource file and the name of the image uploaded to the resource file. Intellisense should pop up on this one for both the name of the resource file and the name of the image.

Protected Overrides ReadOnly Property Internal_Icon_24x24 As system.drawing.bitmap
Get
Return ResourceFileName.BitmapFileName
End Get
End Property

 

Have fun with those icons.

Ben S

 

Comments are closed.