Skip to main content

TcxCustomGroupBox Class

Serves as the base for group box controls.

Declaration

TcxCustomGroupBox = class(
    TcxCustomEdit
)

Remarks

The TcxCustomGroupBox control implements the functionality required by group box controls. Such controls are used to display related controls within logical groups and to give captions to these groups.

For example, with a form where users provide their personal details and credit card information, you may want to arrange the controls into two groups. The first group will contain edit fields for personal information while the second contains credit card input fields. The form can look as displayed below.

You can use TcxCustomGroupBox descendants as panels. To accomplish this, enable the PanelStyle.Active option, and customize panel appearance options via the PanelStyle property. The image below shows an example of a panel.

The Alignment property allows you to change the position of the group box’s caption. You can position the caption string at any control edge and specify its alignment within this edge using this property. Additionally, you can center the caption string within the control’s client area. In this instance, the group box control is displayed as a panel. However, the PanelStyle settings won’t be applied to it.

Using TcxCustomGroupBox descendants, you can also customize the background color, the caption style and the group box’s look and feel. Use the Color, CaptionBkColor, Font and Style.LookAndFeel properties for this purpose. Note that you can enable native painting of the control by setting the Style.LookAndFeel.NativeStyle property to True.

Do not create instances of the TcxCustomGroupBox class in applications. Use this class to create custom group box controls. If you want to add a group box to a form, use the TcxGroupBox control. This control is derived from the TcxCustomGroupBox. It doesn’t provide any new functionality but simply publishes properties.

Important

the OnCustomDrawCaption, OnCustomDrawContentBackground and OnMeasureCaptionHeight events were designed to be used with the skin painting (along with traditional painting styles). Since skinning was developed for platforms starting from Delphi 7 and RAD Studio 2006 or later, the events can only be used in these IDEs.

See Also