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

TControl.GetDefaultColor

Gets the default color for the control.

Declaration

Source position: controls.pp line 1601

public function TControl.GetDefaultColor(

  const DefaultColorType: TDefaultColorType

):TGraphicsColor; virtual;

Arguments

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

TControl.Color

  

The background color of the control.

TControl.Font

  

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

TControl.ParentColor

  

Use the Color from the Parent control, when enabled.

TControl.Parent

  

The control within which the control is shown.

TControl.GetColorResolvingParent

  

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

TControl.GetRGBColorResolvingParent

  

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

TWinControl.SetColor

  

Sets the value for the Color property.

TWinControl.CreateBrush

  

Creates the Brush, if not already created.

TColor

  

Color type used by most LCL drawing functions.

TDefaultColorType

  

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



CT Web help

CodeTyphon Studio