delphi – What is the difference between the Height and ClientHeight properties of a TForm?

Question:

In Delphi a Form has 2 properties to define its height: Height and ClientHeight . But what is the difference between the Height and ClientHeight properties of a TForm?

Answer:

Height is the form's own height. It counts for example the title bar and the top and bottom borders.

ClientHeight is the height available for child form components.

For example, if the height of a modal form is limited to the ClientHeight size of the main form, and that modal form is vertically aligned in the center of the main form, you can still see the main form's title bar behind the modal form.

You can set ClientHeight to determine how much usable space you want for child components, but the most common use is to read this property to constrain the size of child components or the size of modal forms.

Scroll to Top