I would like to create several folders in the project folder where I can save my images. Then I would like to load these pictures into a PictureBox.
How can I now load the Info_Hydraulik.png image?
An image with the path of the file
Kind regards and thank you in advance for your help.
Flammel
For Info_Hydraulik.png
in Visual Studio's Properties change Build Actions
to Embedded Resource
.
If you use WinForms to load PNG
to the `PictureBox':
using System.Reflection;
Assembly assembly = Assembly.GetExecutingAssembly();
// To list all resources use this:
// string[] names = assembly.GetManifestResourceNames();
using (Stream stream = assembly.GetManifestResourceStream
("WindowsFormsApp1.Bu.Hell.Info_Hydraulik.png"))
{
Image image = Image.FromStream(stream);
pictureBox1.Image = image;
}
Adjust the namespace WindowsFormsApp1
in sample code to your project namespace.