A PictureBox control in VB is a placeholder for an image. You apply the box by inserting a PictureBox object into your new form. The PictureBox is a standard object in the Toolbox. You add a PictureBox and then set its properties in order to reference the image that will appear in the placeholder. You can also alter the dimensions of the box in the Properties panel to make the box resize to the size of the image.
- Skill level:
Other People Are Reading
Open Visual Studio and create a new project. This will create a blank form, called Form1. The form will initially be smaller than you need, so resize it by dragging the lower right corner to the bottom right of the design panel.
Click on the “Toolbox” tab on the left edge of the window. This opens the Toolbax, which contains a variety of object types that you can add to the form. Click on “PictureBox” and a new box will appear in your form. Drag the resize points around the edge of the box to resize it.
Put a picture in the Picture box by clicking in the box and opening its Properties panel on the right side of the design panel. Look down the properties of the PictureBox to find “Image” alongside this property will be a value of “(none)” and then a button next to that value. Click on the button to open a dialogue window.
Navigate through your computer’s directory structure to reach the folder where you keep the image you want to display in the PictureBox. Click on the image file and press the “Open” button. The image will display in your PictureBox.
Look for the SizeMode property of the PictureBox. If the image is bigger than the box it will display the top left section of the picture that is covered by the PictureBox size. It will not scale the image to fit the box. Set the SizeMode property to AutoSize. This will cause the PictureBox to expend to the size of the image.
- 20 of the funniest online reviews ever
- 14 Biggest lies people tell in online dating sites
- Hilarious things Google thinks you're trying to search for