Declaration
property MaxWidth: Integer;
Description
Specifies a maximum width (in pixels) for the layer when it is sided automatically (i.e. when
AutoSize is enabled, or
SizeToText is called).
If the text size exceeds the available width, the text will wrap and the layer will become taller.
This option has no effect unless
WordWrap is enabled. It also does not affect user sizing of the layer.
Value | Description |
-1 | Text layer will be auto-sizing to the maximum available width (to the right-hand side of the control) |
0 | The width of the text layer will not change during auto-sizing width (will remain at its currently specified width) |
> 0 | Text layer will become no wider than the specified width when auto-sizing (Strict: user sizing will be ignored) |
< -10 | Text layer will become no wider than the specified width (absolute value) when auto-sizing, unless user has sized it to larger than the max width |
Default: -1
// Text will never be larger than 500 pixels wide after autosizing, even if user tries to make it larger
TIETextLayer( ImageEnView1.CurrentLayer ).MaxWidth := 500;
TIETextLayer( ImageEnView1.CurrentLayer ).AutoSize := True;
// Text will not be larger than 500 pixels wide after autosizing, unless user has made it larger
TIETextLayer( ImageEnView1.CurrentLayer ).MaxWidth := -500;
TIETextLayer( ImageEnView1.CurrentLayer ).AutoSize := True;
// Do not allow the text layer to exceed the width of the background layer
TIETextLayer( ImageEnView1.CurrentLayer ).MaxWidth := ImageEnView1.Layer[0].Width - ImageEnView1.CurrentLayer.PosX;
// Do not allow the text layer width to change (it will become taller to fit the text)
TIETextLayer( ImageEnView1.CurrentLayer ).MaxWidth := 0;
// Do not constrain the text layer width
TIETextLayer( ImageEnView1.CurrentLayer ).MaxWidth := -1;
See Also
◼AutoSize
◼SizeToText
◼TextOverflow
◼WordWrap