Поделиться через


How to: Set the Background of a Windows Forms Panel Using the Designer

A Windows Forms Panel control can display both a background color and a background image. The BackColor property sets the background color for controls that are contained in the panel, such as labels and radio buttons. If the BackgroundImage property is not set, the BackColor selection will fill all of the panel. If the BackgroundImage property is set, the image will be displayed behind the controls that are contained in the panel.

The following procedure requires a Windows Application project with a form that contains a Panel control. For information about how to set up such a project, see How to: Create a New Windows Forms Application Project and How to: Add Controls to Windows Forms.

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 Working with Settings.

To set the background in the Windows Forms Designer

  1. Select the Panel control.

  2. In the Properties window, click the arrow button next to the BackColor property to display a window with three tabs.

  3. Select the Custom tab to display a palette of colors.

  4. Select the Web or System tab to display a list of predefined names for colors, and then select a color.

  5. In the Properties window, click the arrow button next to the BackgroundImage property.

  6. In the Open dialog box, select the file that you want to display.

See Also

Tasks

How to: Group Controls with the Windows Forms Panel Control Using the Designer

Reference

Panel Control Overview (Windows Forms)

BackColor

BackgroundImage

Other Resources

Panel Control (Windows Forms)