Udostępnij za pośrednictwem


How to: Load a Picture Using the Designer (Windows Forms)

With the Windows Forms PictureBox control, you can load and display a picture on a form at design time by setting the Image property to a valid picture. The following table shows the acceptable file types.

Type

File name extension

Bitmap

.bmp

Icon

.ico

GIF

.gif

Metafile

.wmf

JPEG

.jpg

Note

The dialog boxes and menu commands you see might differ from those described in Help depending on your active settings or edition. To change your settings, choose Import and Export Settings on the Tools menu. For more information, see Visual Studio Settings.

To display a picture at design time

  1. Draw a PictureBox control on a form.

  2. On the Properties window, select the Image property, then click the ellipsis button to display the Open dialog box.

  3. If you are looking for a specific file type (for example, .gif files), select it in the Files of type box.

  4. Select the file you want to display.

To clear the picture at design time

  • On the Properties window, select the Image property and right-click the small thumbnail image that appears to the left of the name of the image object. Choose Reset.

See Also

Tasks

How to: Modify the Size or Placement of a Picture at Run Time (Windows Forms)

How to: Set Pictures at Run Time (Windows Forms)

Reference

PictureBox Control Overview (Windows Forms)

PictureBox

Other Resources

PictureBox Control (Windows Forms)