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

# TColorButton.DrawGlyph

Re-implements drawing the glyph for the control to use the selected color.

## Declaration

Source position: dialogs.pp line 363

`protected function TColorButton.DrawGlyph(`
`ACanvas: TCanvas;`
`const AClient: TRect;`
`const AOffset: TPoint;`
`AState: TButtonState;`
`ATransparent: Boolean;`
`BiDiFlags: LongInt`
`):TRect; override;`

## Arguments

`ACanvas` |  | Drawing surface where the control is drawn.
`AClient` |  | Client rectangle where the button face / color block is rendered.
`AOffset` |  | TPoint with horizontal and vertical offsets in AClient where the glyph is drawn.
`AState` |  | Button state for the glyph; bsDisabled draws the disabled pattern for the button control.
`ATransparent` |  | Not used in the method.
`BiDiFlags` |  | Not used in the method.

## Function result

Rectangle where the color block is drawn for the control.

## Description

DrawGlyph is an overridden method in TColorButton. It re-implements the ancestor method to draw the button face and color block (or swatch) for the control using the arguments passed to the method.

The value in AState determines the appearance for the glyph (color swatch). When set to bsDisabled, a bitmap with a disabled pattern (dotted lines) is drawn using the Color for the button face. Otherwise, the value in ButtonColor is used to draw the glyph. GetGlyphSize is called to get the dimensions for the glyph based on the settings in ButtonColorAutoSize and ButtonColorSize.

The return value is a TRect instance with the bounds affected in the drawing operation.

DrawGlyph calls the Rectangle method for the TCanvas instance in the Canvas argument using the return value for the method as an argument.

DrawGlyph does not call the inherited method which draws the glyph image for the speed button.

DrawGlyph is called from the MeasureDraw method in the ancestor class.

## See also

TColorButton.Color |  | The Color of the control itself, i.e. the parts that are not the color display block; edges, background etc.
TColorButton.ButtonColor |  | The TColor value selected in the button control.
TColorButton.ButtonColorAutoSize |  | True if the color block for the button can be automatically resized to fill the unused client area.
TColorButton.ButtonColorSize |  | Size of the color block (or swatch) on the button control.
TColorButton.GetGlyphSize |  | Gets the size for the glyph (color block / swatch) on the button control.
TCustomSpeedButton.DrawGlyph |  | Draws the glyph image on the canvas at a given offset in the specified client rectangle.
TCustomSpeedButton.MeasureDraw |  | Draws the glyph image on the canvas at a given offset in the specified client rectangle.
TButtonState |  | A set of constants to define the state of a SpeedButton.