When you add existing files to the project using Resources.resx (under Properties) by default the build action will be none. You need to select the file under the resources folder and chnage the build action to Embeded Resource
which means it will be included in the assembly or Content
which means it won't be included in your assembly.
To get a list of all embeded resources, you can use this:
string[] embededResources = Assembly.GetExecutingAssembly().GetManifestResourceNames();
To use the resources:
//OctoBox: Picturebox
//Octocat: Octocat.png image
//Tested with:
//Build action: Embeded Resource
// 1st:
OctoBox.Image = (Bitmap)Resources.ResourceManager.GetObject("Octocat");
//2nd
Assembly asm = Assembly.GetExecutingAssembly();
Stream octoStream = asm.GetManifestResourceStream($"{asm.GetName().Name}.Resources.Octocat.png");
if (octoStream != null)
{
OctoBox.Image = Image.FromStream(octoStream);
octoStream.Close();
}
//Tested with:
//Build action: None, Content and embeded resource
OctoBox.Image = Resources.Octocat;
The last one being the easiest with intellisense.