Panel Control Overview (Windows Forms)
.NET Framework 2.0
Windows Formscontrols are used to provide an identifiable grouping for other controls. Typically, you use panels to subdivide a form by function. For example, you may have an order form that specifies mailing options such as which overnight carrier to use. Grouping all options in a panel gives the user a logical visual cue. At design time all the controls can be moved easily — when you move the Panel control, all its contained controls move, too. The controls grouped in a panel can be accessed through its property. This property returns a collection of instances, so you will typically need to cast a control retrieved this way to its specific type.
To display scroll bars, set theproperty to true. You can also customize the appearance of the panel by setting the , , and properties. For more information on the BackColor and BackgroundImage properties, see . The BorderStyle property determines if the panel is outlined with no visible border ( ), a plain line ( ), or a shadowed line ( ).