How to load an image into a PictureBox - PictureBox Example Part 1






In this mini tutorial I'll explain you how you can set the image to the PictureBox object using the Visual Studio IDE. There are several ways of doing this. The one mentioned here will load an image from a file using the filechooser.
I will explain other ways of loading images at runtime and from a resource object in future posts.


  1. Create a Windows Form Application Project.
  2. Drag a PictureBox Object to the window in the visual designer.
  3. Set the PictureBox image property to the image file you want (select local resource and click "Import").
  4. Done, Run your application.
 note: There is no code to add as this method only uses the Visual designer to accomplish this.

Screenshots below:

Create a Windows Form Application Project
Drag a PictureBox Object to the window in the visual designer.
Set the PictureBox image property to the image file you want.
Set the PictureBox image property to the image file you want (select local resource and click "Import").
Choose the file you want to load.
You can add more files to your resource if you want. Click Ok

The Image is displayed on the picturebox.
Run the Application (F5).

No comments:

Post a Comment

2 ads