Udostępnij za pośrednictwem


Select Resource Dialog Box

Use this dialog box to assign an image to a form or control in your Windows Forms application. Open the Properties window for the form or control to which the image will be assigned, select the BackgroundImage property, and then click the Ellipsis (VisualStudioEllipsesButton screenshot) button to open the dialog box.

  • Resource context
    Visual Studio supports two resource scopes: local and project. Select the context for your resources by clicking the appropriate radio button.

  • Local resource
    Specifies a resource in a form or control's local resource (.resx) file.

  • Import
    Activates the Open dialog box, which enables you to browse for an image file to import. Importing an image will cause it to be copied to your form or control's .resx file.

  • Clear
    Removes the assigned image from your form or control's .resx file and clears the BackgroundImage property. Resetting the BackgroundImage property in the Properties window has the same effect.

  • Project resource file
    The drop-down control lists the .resx files currently attached to your project. The images in the selected resource file appear in the lower list. Select (none) to clear the BackgroundImage property.

  • Preview window
    Shows the selected image. If the image is larger than the Preview window, the central part of the image is displayed. You can resize the dialog box to view more of the imported image.

  • Import
    Activates the Open dialog box, which enables you to browse for an image file to import. Importing an image will cause it to be copied to your project's Resources folder, and a reference to the copied file will be inserted into the .resx file selected in the Resource list.

To remove a background image from a form, you can also return to the Properties window, right-click the BackgroundImage property, and click Reset.

Note

Use the Resource Designer if you need to manage a collection of images. For more information, see Managing Application Resources.

See Also

Tasks

How to: Add Background Images to Windows Forms

Concepts

Resources in Applications

Creating Resource Files

Reference

Image Editor

Resource Editors

ResourceManager

StronglyTypedResourceBuilder

Other Resources

Windows Forms Designer Dialog Boxes

Managing Application Resources