[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] |
Defines how child controls are resized / aligned.
Source position: controls.pp line 1938
type TChildControlResizeStyle = ( |
||
crsAnchorAligning, |
|
Uses a static layout for normally anchored controls. |
crsScaleChilds, |
|
Scale children keeping fixed space between children. |
crsHomogenousChildResize, |
|
Enlarge children equally, i.e. by the same number of pixels. |
crsHomogenousSpaceResize, |
|
Enlarge space between children equally. |
crsSameSize |
|
Each child gets the same size (maybe one pixel difference). |
); |
TChildControlResizeStyle is an enumerated type with values that represent the resizing styles used to resize and position child controls in a tabular arrangement.
TChildControlResizeStyle the type used for the EnlargeHorizontal, EnlargeVertical, ShrinkHorizontal, and ShrinkVertical properties in TControlChildSizing.
The enumeration values identify the algorithm used to resize and position the child controls on a parent when its ChildSizing.Layout property set to a value other than clNone. The resizing algorithms apply to child controls which do not have settings in their Align, Anchors, or AnchorSide properties which determine the position / alignment for the child control. Anchored or aligned controls are excluded from the tabular layout.
Uses a static layout for normally anchored controls.
crsAnchorAligning examines child controls to get the preferred size and any size constraints (minimum or maximum) for each. Preferred size determines the dimensions for a control. Size constraints determine whether the control size is adjusted to the corresponding minimum or maximum value. The child sizing Layout in the parent control determines the order and direction the child controls are arranged in the tabular layout. The larger of the derived control sizes is used for all controls in the same column or row in the tabular layout.
Values from the BorderSpacing and ChildSizing properties in the parent control determine where the control matrix is displayed and the spacing used between adjacent controls. See TControl.BorderSpacing and TControl.ChildSizing for more information.
The derived sizes for child controls and their positions do not change when the parent control is resized. This algorithm does not try to fill unused space on the parent control. Unused space is displayed to right of or beneath the control matrix.
Scales child controls with fixed spacing between the controls.
crsScaleChilds examines child controls to get the preferred size and any size constraints (minimum or maximum) for each. Preferred size determines the dimensions for a control. Size constraints determine whether the control size is adjusted to the corresponding minimum or maximum value. The derived control size is the size to which it would autosize if it was not anchored / size-controlled.
The child sizing Layout in the parent control determines the order and direction the child controls are arranged in the tabular layout. Values from the BorderSpacing and ChildSizing properties in the parent control determine where the control matrix is displayed and the spacing used between adjacent controls. See TControl.BorderSpacing and TControl.ChildSizing for more information.
The larger of the derived control sizes is used for all controls in the same column or row in the tabular layout. The size for a column or row is scaled to fill the unused space in the parent while keeping the ratio for the derived size relative to the size of the parent control. A size constraint present in a column or a row is enforced in the tabular layout. Adjacent controls are scaled to fill unused space after the size constraint has been applied.
For a horizontal left-to-right layout with 3 controls A, B, and C:
Parent.ClientWidth = 120 A Preferred Width = 10 B Preferred Width = 20 C Preferred Width = 30 A, B, C are scaled by a factor of 2.0 (120/60) for scaled widths of 20, 40 and 60 respectively.
If B has a maximum width constraint of 30, then A and C are resized equally with the remaining space made available by the size constraint. Scaling factor for A and C is (120-30)/40 or 2.25.
Parent.ClientWidth = 120 A.Width = 23 B.Width = 30 C.Width = 67
Enlarge or shrink child controls equally, i.e. by the same number of pixels.
crsHomogenousChildResize applies a homogenous size to child controls in the tabular layout. Child controls are resized to their preferred size by default and use the controls per line and spacing defined in the ChildSizing for the parent control. Size constraints in child controls are used when calculating the display size for the controls in the same column or row. Unused space in the client area for a parent control is distributed equally to the size for each child control which is not size constrained.
For a horizontal left-to-right layout with 3 controls A, B, and C:
Parent.ClientWidth = 120 A Preferred Width = 10 B Preferred Width = 20 C Preferred Width = 30 A, B, C are resized to include 20 additional pixels per child control (120-60)/3. A.Width = 30 B.Width = 40 C.Width = 50
If B has a maximum width constraint of 30, then the size made available by the constraint is allocated equally to A and C. 120-30-10-30/2=25 pixels.
A.Width = 35 B.Width = 30 C.Width = 55
Enlarges the space between child controls equally.
crsHomogenousSpaceResize applies a uniform number of pixels as horizontal or vertical spacing between child controls on the same column or row. The size for the controls are derived using the preferred size and any size constraints (minimum or maximum) for the child controls. The collective derived size is applied to all controls in the same column or row. The remaining space on the parent is allocated equally as spacing before, between, and after each column or row in the tabular layout - including on the left / right or top / bottom edges of the Control.
For a horizontal left-to-right layout with 3 controls A, B, and C:
Parent.ClientWidth = 120 A Preferred Width = 10 B Preferred Width = 20 C Preferred Width = 30 Unused space (120-60)/4=15 is allocated equally as Left, Right, and Horizontal spacing.
Column widths do not change when the parent control is resized; only the spacing between edges and columns is affected.
Each child gets the same size (maybe one pixel difference due to rounding).
crsSameSize applies a uniform size to all columns or rows in the tabular layout. The unused space on the parent control, after BorderSpacing and ChildSizing spacings are applied, is allocated equally for the number of controls per line in the columns or rows. Size constraints (minimum or maximum) for child controls are enforced if a constraint would be enabled for the derived size. All child controls in the same column or row are given the same derived size.
For a horizontal left-to-right layout with 3 controls A, B, and C:
Parent.ClientWidth = 120 A Preferred Width = 10 B Preferred Width = 20 C Preferred Width = 30 Each column is given a width of 40 pixels (120/3). A.Width = 40 B.Width = 40 C.Width = 40
If B has a maximum width constraint of 30, then the space made available by the size constraint is allocated equally to A and C.
A.Width = 45 B.Width = 30 C.Width = 45
Column widths are recalculated when the parent control is resized.
Please note that the differences between the crsScaleChilds, crsHomogenousChildResize, and crsSameSize algorithms largely disappear when one or more of the child controls have a minimum or maximum size constraint applied.
|
Indicates how child controls are expanded and aligned horizontally on the parent Control. |
|
|
Indicates how child controls are expanded or aligned vertically on the parent Control. |
|
|
Indicates how child controls are shrunk and aligned horizontally on the parent Control. |
|
|
Indicates how child controls are shrunk and aligned vertically on the parent Control. |
|
|
Provides settings used to resize and align child controls using a tabular layout. |
|
|
Override this method to return a different preferred height and/or width for auto-sizing. |
|
|
Returns default/preferred height and width, for use in auto-sizing. |
|
|
Holds minimum and maximum values for the width or height of a control. |
|
|
Describes the (minimum) spacing around a control. |
Version 4.0 | Generated 2025-05-03 | Home |