viktor80 viktor80 - 1 year ago 114
C# Question

How to set path for images to display it through name with different sequences for executable

I'm trying animate 4 images with different sequences, so I'm wondering how to set path to display images with name and also use this path for executable. Question is, where I have to save pictures folder, and how to get path to display images with different sequences through variable name for excusable file to make it available for other users and do not do it that way:

Bitmap img1, img2, img3, img4;

img1 = new Bitmap(@"D:\my_doc\folder\images\1.png", true);
img2 = new Bitmap(@"D:\my_doc\folder\images\2.png", true);
img3 = new Bitmap(@"D:\my_doc\folder\images\3.png", true);
img4 = new Bitmap(@"D:\my_doc\folder\images\4.png", true);

pictureBox1.Image = img1;

Answer Source

Follow this article to add your images to project resources.

enter image description here

After adding the images you can write some codes like this:

System.Drawing.Bitmap img1, img2, img3, img4;

img1 = YourProjectsBaseNamespace.Properties.Resources.img1
img2 = YourProjectsBaseNamespace.Properties.Resources.img2
img3 = YourProjectsBaseNamespace.Properties.Resources.img3
img4 = YourProjectsBaseNamespace.Properties.Resources.img4
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download