Unit 'Controls' Package
[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] [#lcl]


Gets the default color for the control.


Source position: controls.pp line 1601

public function TControl.GetDefaultColor(

  const DefaultColorType: TDefaultColorType

):TGraphicsColor; virtual;




Identifies the color type needed in the return value (brush or font).

Function result

TColor value for the specified color type.


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:

Background or fill color for the control (Color). Returns the clWindow system color.
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



The background color of the control.



The font to be used for text display in this control.



Use the Color from the Parent control, when enabled.



The control within which the control is shown.



Returns the color of the control while resolving clDefault and ParentColor.



Returns a RGB value for the color used on the control.



Sets the value for the Color property.



Creates the Brush, if not already created.



Color type used by most LCL drawing functions.



Indicates whether a default color applies to a font or a brush.

CT Web help

CodeTyphon Studio