Declaration
procedure TIETextLayer.SizeToText(EnlargeOnly: Boolean = False; LengthenOnly: Boolean = False);
Description
Updates the size of the layer to fit the displayed text.
If
EnlargeOnly is true, the layer will not be reduced in size to fit the text more tightly, only enlarged to ensure all text is visible.
If
LengthenOnly is False, the layer will be widened to the maximum available width. If
LengthenOnly is True, the layer will only be made taller (
WordWrap must be true).
Note: You can also use
MaxWidth to constrain the text layer width (cause it to lengthen when
wrapped)
// Apply a "Paid" stamp to image
with ImageEnView1 do
begin
LayersAdd( 'PAID', 42, clRed, 'Arial Black', [fsBold] );
CurrentLayer.Rotate := 30;
TIETextLayer( CurrentLayer ).SizeToText();
CurrentLayer.PosX := IELayer_Pos_HCenter;
CurrentLayer.PosY := IELayer_Pos_VCenter;
LayersMergeAll();
end;
// Resize the current text layer, making it taller rather than wider (WordWrap must be true)
TIETextlayer( ImageEnView1.CurrentLayer ).SizeToText( False, True );
See Also
◼AutoSize◼TextOverflow◼MaxWidth◼WordWrap