TControl.GetDefaultColor function
Gets the default color for the control.
Declaration
function GetDefaultColor(const DefaultColorType: TDefaultColorType)
: TColor; virtualArguments
DefaultColorType | Identifies the color type needed in the return value (brush or font). |
Function result
TColor value for the specified color type.
Description
GetDefaultColor is a
TColor function used to resolve
the default color (
clDefault) to a TColor value for the control.
GetDefaultColor can return a color value for either the control background or
its text. The
DefaultColorType argument identifies which value is
needed in the return value. In TControl, the following color types and values
are used:
- dctBrush
- Background or fill color for the control (Color). Returns the clWindow system color.
- dctFont
- Text color for the control (Font.Color). Returns the clWindowText system color.
GetDefaultColor uses the value provided by the corresponding method in the
widgetset class instance when a value other than clDefault is returned. When
not resolved in the widgetset class, the return value is retrieved using the
Parent color or the local values in the class instance. If
ParentColor is True (and Parent is assigned),
the GetDefaultColor method in the Parent control is called to get the
specified color type. Otherwise, one of the values from the preceding list is
used for the color type.
GetDefaultColor is a virtual method and can be overridden in descendent classes to use the colors needed for a specific control.
GetDefaultColor is used in the implementation of the GetColorResolvingParent and GetRGBColorResolvingParent methods. It is also called from the SetColor and CreateBrush methods in the TWinControl descendant.
See also
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
