Bagikan melalui


How to: Group Controls with the Windows Forms GroupBox Control

Windows Forms GroupBox controls are used to group other controls. There are three reasons to group controls:

  • To create a visual grouping of related form elements for a clear user interface.

  • To create programmatic grouping (of radio buttons, for example).

  • For moving the controls as a unit at design time.

To create a group of controls

  1. Draw a GroupBox control on a form.

  2. Add other controls to the group box, drawing each inside the group box.

    If you have existing controls that you want to enclose in a group box, you can select all the controls, cut them to the Clipboard, select the GroupBox control, and then paste them into the group box. You can also drag them into the group box.

  3. Set the Text property of the group box to an appropriate caption.

See Also

Reference

GroupBox

Other Resources

GroupBox Control (Windows Forms)