TLabel
Description
Displays text on a form.
Remarks
Use TLabel to add text that the user cannot edit to a form. This text can be used to label another control, and can set focus to that control when the user types an accelerator key. To add an control to a form that displays text that a user can scroll or edit, use TEdit.
TLabel Properties
Property Align
Property Alignment: Integer (R/W)
Controls the horizontal placement of the text within the label. Set Alignment to specify how the text of the label is justified within the ClientRect of the label control. The effect of the Alignment property is more obvious if the WordWrap property is true and the label includes more than one line of text.
Property Anchors: Integer (R/W)
Property Autosize: Boolean (R/W)
Determines whether the size of the label automatically resizes to accommodate the text. Use AutoSize to make the label adjust its size automatically so the client area accommodates the height and width of the text. When AutoSize is false, the label is fixed in size. When AutoSize is true, the size of the label readjusts whenever the text changes. The size of the label is also readjusts when the Font property changes. When WordWrap is true, the width of the label is fixed. If AutoSize is also true, changes to the text cause the label to change in height. When AutoSize is true and WordWrap is false, the font determines the height of the label, and changes to the text cause the label to change in width.
Property Caption: String (R/W)
Use Caption to specify the text string that the label displays. To underline a character in a Caption that labels a component, include an ampersand (&) before the character. This type of character is called an accelerator character. The user can then select the component by pressing Alt while typing the underlined character. To display an ampersand character in the caption, use two ampersands (&&).
Property Color: Integer (R/W)
Property Constraints: Integer (R/W)
Property Enabled: Boolean (R/W)
Property FocusControl:Object (R/W)
Designates a control associated with the label. Set FocusControl to the control that should receive focus when the user presses the accelerator key specified by the label. Specify an accelerator key by preceding a character in the label text with an ampersand (&) and setting the ShowAccelChar property to true.
Property Font: TFont object (R/W)
Property Height: Integer (R/W)
Property Hint: String (R/W)
Property Left: Integer (R/W)
Property Name: String (R/W)
Property ParentColor: Boolean (R/W)
Property ParentFont: Boolean (R/W)
Property ParentShowHint: Boolean (R/W)
Property ShowHint: Boolean (R/W)
Property Top: Integer (R/W)
Property Transparent: Boolean (R/W)
Specifies whether controls that sit below the label on a form can be seen through the label. Set Transparent to true to prevent the label from obscuring other controls on the form. For example, if the label is used to add text to a graphic, set Transparent to true so that the label does not stand out as a separate object.
Property Visible: Boolean (R/W)
Property Width: Integer (R/W)
Property WordWrap: Boolean (R/W)
Specifies whether the label text wraps when it is too long for the width of the label. Set WordWrap to true to allow the label to display multiple line of text. When WordWrap is true, text that is too wide for the label control wraps at the right margin and continues in additional lines. Set WordWrap to false to limit the label to a single line. When WordWrap is false, text that is too wide for the label appears truncated.
TLabel Methods
Method SetBounds(Left, Top, Width, Height: integer)
TLabel Events
Event OnClick (Sender: Object)
Event OnDblClick (Sender: Object)