GroupBox


The GroupBox control displays a caption and a border. This control is mostly for decoration and provides a visually appealing method for grouping related controls on the form.

The GroupBox is also a control container, so you can place other controls inside it. If a GroupBox contains RadioButton controls, those buttons form a group separate from any other RadioButton controls on the form. If you click one of those buttons, the other buttons in the GroupBox deselect, but any selected RadioButton controls outside of the GroupBox remain unchanged. This is important if you need to create more than one group of RadioButton controls.

If you want to create multiple RadioButton groups, but you don’t want to display a caption and border, use a Panel control instead of a GroupBox.

The GroupBox control provides a typical assortment of properties that determine its appearance (such as BackColor, BackgroundImage, and Font). These properties are straightforward.

If you set the control’s Enabled property to False, then its caption is grayed out and any controls it contains are also disabled. This is a convenient way for a program to enable or disable a group of controls all at once.

The GroupBox control’s Controls property returns a collection containing references to the controls inside the GroupBox.

One of the few confusing aspects to working with GroupBox controls in code is figuring out where to position controls within the GroupBox. The control’s borders and caption take up room inside the control’s client area, so deciding how to position controls without covering those decorations is not obvious. Fortunately, the control’s DisplayRectangle property returns a Rectangle object that you can use to position items. This rectangle fills most of the control’s area that isn’t occupied by the caption and borders.




Visual Basic 2005 with  .NET 3.0 Programmer's Reference
Visual Basic 2005 with .NET 3.0 Programmer's Reference
ISBN: 470137053
EAN: N/A
Year: 2007
Pages: 417

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net