Example code required for how to access embedded .Net image resources in C#
It's very easy to mark an image file to become an embedded resource however how does one access the image thereafter. Please can I have some example code?
The most direct method:
YourProjectsBaseNamespace.Properties.Resources.YourImageResourceName
1) Adding and Editing Resources (Visual C#)
System.Drawing.Bitmap bitmap1 = myProject.Properties.Resources.Image01;
2) Accessing Embedded Resources using GetManifestResourceStream
Assembly _assembly = Assembly.GetExecutingAssembly();
Stream _imageStream =
_assembly.GetManifestResourceStream(
"ThumbnailPictureViewer.resources.Image1.bmp");
Bitmap theDefaultImage = new Bitmap(_imageStream);
Look at the third code snippet at http://msdn.microsoft.com/en-us/library/aa309403(VS.71).aspx