- Back to Home »
- Windows Applications »
- PictureBox
Posted by :
Sudhir Chekuri
Monday, 15 February 2016
Used to display image on the form.
To set static image:
Click on smart tag – Select local resource – import to select an image to display image.
Import option is used to set image without copying image to project location. So, with the setup image will not be carried away. So, next option project resource is recommend.
Click on smart tag – Select project resource file – import to select an image to display image by copying it into Resources folder in your project.
Default event: Click which is fired when user click on the picture box.
Example code to change the image when user click on the picture box:
To set static image:
Click on smart tag – Select local resource – import to select an image to display image.
Import option is used to set image without copying image to project location. So, with the setup image will not be carried away. So, next option project resource is recommend.
Click on smart tag – Select project resource file – import to select an image to display image by copying it into Resources folder in your project.
Default event: Click which is fired when user click on the picture box.
Example code to change the image when user click on the picture box:
private void pictureBox1_Click(object sender, EventArgs e)
{
pictureBox1.ImageLocation=@"C:\Users\bc250150\Pictures\Flower.jpg";
}