Grasshopper

algorithmic modeling for Rhino

My first component is operating well ! Thanks David.

All I have to do is to assign the bitmap to the component.

protected override System.Drawing.Bitmap Icon  

At this method, what I should type in?

return Resource. ~~ and Where is the Resource folder ?

Thanks in advance ~!

Views: 566

Replies to This Discussion

The easiest way is to embed an image (png file format if at all possible) in the resources of the assembly. Then you can access it via:

return MyAssemblyName.Properties.Resources.ImageFileName;

--

David Rutten

david@mcneel.com

hum..

I create new folder (named Resources) in the Properties folder and embed my .png file to there.

But... as you can see, there is error 

"missing a using directive or an assembly reference~" hum... I don't know why (T^T) help..

Do not create the folder yourself. In fact, delete the folder and put the png file in a folder called Images or Icons or Graphics or something.

Then go into your project properties (the little spanner icon in the Project browser). In here, make sure you have resources and add the png file. Visual Studio will create the resources file you need.

I agree it would be nice to be able to access files directly on the disc from within code, but it doesn't work.

--

David Rutten

david@mcneel.com

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service