Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Image source winforms

Hi how can i set image source to an image in winforms?

my images are in Resources folder in the application only

I tried like this

PictureBox pb = new PictureBox(); pb.Image = Image.FromFile("Resources/a.gif");

But it is showing file not found exception.

Thanks in advance

like image 714
Nagu Avatar asked Dec 14 '22 03:12

Nagu


2 Answers

If the image is in your application's resources, you can do that :

pb.Image = Properties.Resources.a
like image 90
Thomas Levesque Avatar answered Jan 02 '23 22:01

Thomas Levesque


pictureBox1.Image = Properties.Resources.[image name];
like image 37
Sorantis Avatar answered Jan 02 '23 22:01

Sorantis