Unit 'Controls' Package
[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] [#lcl]

TControl.Height

The vertical size for the control.

Declaration

Source position: controls.pp line 1843

published property TControl.Height : Integer
  read FHeight
  write SetHeight;

Description

Height is an Integer property with the vertical size for the control in pixels.

Setting a negative value in Height is not allowed, and the property defaults to 0 (zero). At design-time, setting Height to a value not in the range 0..9999 causes an ELayoutException to be raised (and handled in the IDE).

Setting a new value for the property causes SetBounds and ChangeBounds to be called. This ensures that the new value is in the range allowed in Constraints, and that the control is aligned on its Parent using the Anchors for the control.

A value assigned to Height is ignored when AutoSize is set to True; the control is automatically adjusted to the size needed for its aligned content.

Values in Top, Left, Width, and Height are used to calculate the display area for the control in GetClientRect. They determine the clipping rectangle used when the control is drawn on its Parent.

Remark: In the LCL, Height has the same value as ClientHeight. Derived classes (like TCustomForm or TForm) may implement a ClientHeight property that differs from Height - but in the current LCL version, they do not. This differs from the behavior in the Delphi VCL where the value in Height includes pixels used in non-client areas like the title bar, borders, frames, and scroll bars. LCL uses this approach because there is no reliable way to determine the sizes for all of the non-client areas on all of the platforms where LCL is supported. Without a reliable way, the LCL would needlessly move the forms around on the screen or resize them endlessly. In the LCL, neither Height nor ClientHeight include the non-client area on a form instance. The height of a TMainMenu instance is omitted from both values as well.

See also

TControl.ClientHeight

  

The height for the client area on the control.

TControl.Left

  

The client coordinate with the left edge for the control.

TControl.Top

  

The client coordinate for the top edge of the control.

TControl.Width

  

The horizontal size for the control.

TControl.Parent

  

The control within which the control is shown.

TControl.GetClientRect

  

Gets the value for the ClientRect property.

TControl.SetBounds

  

Sets the bounds (Left, Top, Width, Height) of the control.

TControl.ChangeBounds

  

Sets the bounds (left, top, height, width) and optionally the BaseBounds of the control.