Sign in Join
FPDoc Onlineexperiment

TColorButton.DrawGlyph function

Member of TColorButtonprotectedIn unit Dialogs

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

Declaration

pascal
function 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

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.