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.
Perfect tutorial. Thanks a lot. I was looking for something EXACTLY like this.
Kudos!
new Icon(global::MyApp.Properties.Resources.IconName, 16, 16)
where:
MyApp = application name
IconName = icon resource name