System.Drawing.Icon and embedded rersources

To use an icon resource embedded into your assemply: 

1) Add icon to project and make it an “Embedded Resource” type (no need to copy to output directory).

2) Construct your System.Drawing.Icon like this:

new Icon(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("MyShinyApp.hammer.ico"));

Where MyShinyApp is the value specified in “Default namespace” property of your project (Application tab of project properties) and hammer.ico is the name of your icon.


2 thoughts on “System.Drawing.Icon and embedded rersources

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s