[Overview][Types][Classes][Procedures and functions][Index] | Reference for unit 'ExtCtrls' (#lcl)

# TCustomPanel.SetParentBackground

Sets the value for the ParentBackground property.

## Declaration

Source position: extctrls.pp line 1151

`protected procedure TCustomPanel.SetParentBackground(`
`const AParentBackground: Boolean`
`); override;`

## Arguments

`AParentBackground` |  | When True, the panel is drawn with transparency.

## Description

SetParentBackground is an overridden method used to set the value for the ParentBackground property. SetParentBackground ensures that the ControlStyle property is updated to include or omit the values which control the opacity for the control. When AParentBackground contains True, the value csParentBackground is included in ControlStyle. When AParentBackground contains False, csParentBackground is excluded from ControlStyle.

The UpdateParentColorChange method is called to update ControlStyle to reflect the values in the ParentColor or ParentBackground properties. If either ParentColor or ParentBackground are set to True, csOpaque is excluded from ControlStyle and the control becomes transparent. When both properties are set to False, csOpaque is included in ControlStyle and the control is drawn using the value in Color as the background color.

## See also

TCustomPanel.UpdateParentColorChange |  | Updates the control to reflect changes to the ParentColor property.
TCustomPanel.ParentColor |  | Indicates if the control is drawn using the color in the parent control.
TCustomPanel.ParentBackground |  | Indicates if the background from the parent control is used to draw the background for the control.
TControl.SetParentBackground |  | Sets the value for the ParentBackground property.
TControl.COntrolStyle |  | Contains style flags which control the features or behaviors enabled for the control.
TControlStyleType |  | Enumerated type with values for features or behaviors for a control.