Sign in Join
FPDoc Onlineexperiment

TCustomLabel.DoDrawText procedure

Member of TCustomLabelprotectedIn unit StdCtrls

Performs actions needed to draw the text of the label or to calculate its size.

Declaration

pascal
procedure DoDrawText(var Rect: TRect; Flags: LongInt); virtual

Arguments

Rect

Text rectangle used to draw the label text.

Flags

Bit mask of flags used to control how the text is rendered.

Description

DoDrawText performs action needed to draw the text for the label or to calculate the size occupied by it.

When the option bit DT_CALCRECT is set in the Flags parameter, only the size of the rectangle occupied by the text is calculated and returned in the Rect parameter; nothing is drawn here.

The GetLabelText method is called to get the text handled by the method.

DoDrawText calls the DrawText routine to paint the text on the Canvas using the text rectangle and flags passed as arguments.

When the Enabled property is FalseDrawText is called immediately before the main painting step with a Font color of clGrayText if themes are enabled, or clBtnHighlight otherwise. The final drawing step then is done with color clBtnShow to render the "shadow" part of the disabled label. These Font changes are reverted prior to exiting the method.

DrawText is called a second time to render the shadow part for a disabled label when themes are not enabled. The shadow text has the color clBtnShadow.

DoDrawText is called from the Paint and CalculateSize methods.

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