Sign in Join
FPDoc Onlineexperiment

TCustomLabel.CalculateSize procedure

Member of TCustomLabelprotectedIn unit StdCtrls

Gets the height and width needed for the label text.

Declaration

pascal
procedure CalculateSize(MaxWidth: Integer; var NeededWidth: Integer; 
 var NeededHeight: Integer)

Arguments

MaxWidth

Maximum width for the text rectangle in the label.

NeededWidth

Width needed for the text.

NeededHeight

Height needed for the text.

Description

Calculates the size for the label text using the formatting defined in related property values.

NeededWidth and NeededHeight are variable parameters updated in the method to reflect the values needed after applying DrawText flags to the label text. The DrawText flags include constants which represent the following properties:

  • WordWrap
  • HasMultiLine
  • ShowAccelChar
  • UseRightToLeftReading

The following constants are also used in the DrawText flags:

  • DT_CALCRECT
  • DT_EXPANDTABS
  • DT_NOCLIP
  • in case of rotated text also DT_LEFT, DT_RIGHT, DT_CENTER, DT_TOP, DT_VCENTER, DT_BOTTOM

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