Aracılığıyla paylaş


How to: Add Background Images to Windows Forms

When designing your Windows Forms, you may sometimes want to place a background image in a control or on the form itself. You can accomplish this easily by using the Properties window.

To add a background image to a Windows Form

  1. Click the form's BackgroundImage property in the Properties window. Click the ellipsis (VisualStudioEllipsesButton screenshot) button to open the Select Resource dialog box.

  2. Click Import to open the Open File dialog box. Navigate to a bitmap (.bmp) file, for example <Windows folder>/Rhododendron.bmp. Click Open to accept your choice.

    Note that the file you picked now appears in the Entry list, and the image appears in the Preview box.

  3. Click OK to import the image as a resource. Note that the image now appears on your form. You can use the BackgroundImageLayout property to control the appearance of the image on the form.

    Note also that your project now has a folder called Resources into which the source image has been copied.

To remove a background image from a Windows Form

  • In the Properties window, right-click the ellipsis (VisualStudioEllipsesButton screenshot) button for the BackgroundImage property, then click Reset.

See Also

Concepts

Resources in Applications

Creating Resource Files

Reference

Select Resource Dialog Box

Image Editor

Resource Editors

ResourceManager

StronglyTypedResourceBuilder