Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change PictureBox's image to image from my resources?

How do I set a PictureBox image to an image from my resources?

(I tried this without success: pictuerbox.Image = "img_location";)

like image 916
MasterMastic Avatar asked Jul 02 '11 23:07

MasterMastic


People also ask

How do I add an image to a resource?

Add Image ResourceIn Visual Studio, click the Project menu, and select Add Existing Item. Find and select the image you want to add to your project. In the Solution Explorer window, right-click the image file you just added to your project, and select Properties from the popup menu.

How do I add an image to a resource in Winforms?

Click "Import", locate the folder where the background image is located, select the background image, click "OK", the background of control button is the selected image, and it is also imported into the Resource, if other controls are also needed, select it in the "Select Resource" dialog box(Figure 2).


1 Answers

If you loaded the resource using the visual studio UI, then you should be able to do this:

picturebox.Image = project.Properties.Resources.imgfromresource 
like image 140
Ken Wayne VanderLinde Avatar answered Sep 19 '22 18:09

Ken Wayne VanderLinde