TControl.GetPreferredSize

Returns the preferred size of this control

Source

UserInterface.Control.pas (316)

Description

AvailableSize is passed in so the control can take this into account. However, the control is not required to return a size that is smaller than the available size. This function should only be called after the control has been inserted into a properly rooted control hierarchy for which the properties of the applicable rendering device are fully available (IsBoundToLayout). This ensures that resources like fonts can be used properly in size calculations.

The value returned from this function can differ from the value returned from GetScrollSize. GetScrollSize should return the full extent over which a scroll panel should scroll this control. GetPreferredSize can choose to return a smaller or larger size as desired. It may be smaller when, for instance, it is impractable to return the full extent as it may be way too large. On the contrary it may be larger when, for instance, it is convenient for the user to have some slack space in the control to be able to interact with it more easily.