ImageEn, unit iexLayers

TIETextLayer.Text

TIETextLayer.Text


Declaration

property Text: String;


Description

Specifies the displayed text.

Note:
- The default text for new layers is specified by DefaultLayerText
- Setting Text has no effect if RulerMode is iermLabel
- For text borders and special fills, use TextStyling
- If you have enabled Rich Text formatting, then use RichText to specify the text


Examples

// Append a text layer
ImageEnView1.LayersAdd( ielkText );
TIETextLayer( ImageEnView1.CurrentLayer ).Text := 'This is a Text Layer';
TIETextLayer( ImageEnView1.CurrentLayer ).BorderColor := clBlack;
TIETextLayer( ImageEnView1.CurrentLayer ).BorderWidth := 1;
TIETextLayer( ImageEnView1.CurrentLayer ).FillColor := clWhite;
ImageEnView1.Update();




// Yellow text without border
ImageEnView1.LayersAdd( ielkText, 100, 100 );
txtLayer := TIETextLayer( ImageEnView1.CurrentLayer );
txtLayer.Font.Size := 54;
txtLayer.Font.Style := [fsBold];
txtLayer.Font.Color := clYellow;
txtLayer.Text := 'ImageEn!';
txtLayer.SizeToText();
ImageEnView1.Update();




// Yellow text with red border
ImageEnView1.LayersAdd( ielkText, 100, 100 );
txtLayer := TIETextLayer( ImageEnView1.CurrentLayer );
txtLayer.Font.Size := 54;
txtLayer.Font.Style := [fsBold];
txtLayer.Font.Color := clYellow;
txtLayer.TextStyling.BorderWidth := 3;
txtLayer.TextStyling.BorderColor := clRed;
txtLayer.Text := 'ImageEn!';
txtLayer.SizeToText();
ImageEnView1.Update();




// Semi-transparent white text with red border
ImageEnView1.LayersAdd( ielkText, 100, 100 );
txtLayer := TIETextLayer( ImageEnView1.CurrentLayer );
txtLayer.Font.Size := 54;
txtLayer.Font.Style := [fsBold];
txtLayer.Font.Color := clWhite;
txtLayer.TextStyling.BorderWidth := 3;
txtLayer.TextStyling.BorderColor := clRed;
txtLayer.TextStyling.FillTransparency1 := IEOpacityToAlpha( 30 ); // 30% opaque
txtLayer.Text := 'ImageEn!';
txtLayer.SizeToText();
ImageEnView1.Update();




// Transparent text with rounded yellow border
ImageEnView1.LayersAdd( ielkText, 100, 100 );
txtLayer := TIETextLayer( ImageEnView1.CurrentLayer );
txtLayer.Font.Size := 54;
txtLayer.Font.Style := [fsBold];
txtLayer.Font.Color := clWhite;
txtLayer.TextStyling.BorderWidth := 3;
txtLayer.TextStyling.BorderColor := clYellow;
txtLayer.TextStyling.BorderLineJoin := ieljRound;
txtLayer.TextStyling.FillTransparency1 := 0; // 100% transparent
txtLayer.Text := 'ImageEn!';
txtLayer.SizeToText();
ImageEnView1.Update();




// Gradient text with border
ImageEnView1.LayersAdd( ielkText, 100, 100 );
txtLayer := TIETextLayer( ImageEnView1.CurrentLayer );
txtLayer.Font.Size := 54;
txtLayer.Font.Style := [fsBold];
txtLayer.Font.Color := clRed;
txtLayer.TextStyling.BorderWidth := 3;
txtLayer.TextStyling.BorderColor := clBlack;
txtLayer.TextStyling.FillColor2 := clYellow;
txtLayer.TextStyling.FillGradient := gpgVertical;
txtLayer.Text := 'ImageEn!';
txtLayer.SizeToText();
ImageEnView1.Update();




// Centered gradient text without border
ImageEnView1.LayersAdd( ielkText, 100, 100 );
txtLayer := TIETextLayer( ImageEnView1.CurrentLayer );
txtLayer.Font.Size := 54;
txtLayer.Font.Style := [fsBold];
txtLayer.Font.Color := clRed;
txtLayer.TextStyling.BorderWidth := 0;
txtLayer.TextStyling.FillColor2 := clWhite;
txtLayer.TextStyling.FillGradient := gpgVertCenter;
txtLayer.Text := 'ImageEn!';
txtLayer.SizeToText();
ImageEnView1.Update();




// Text with gradient ranging from 0% to 70% opacity
ImageEnView1.LayersAdd( ielkText, 100, 100 );
txtLayer := TIETextLayer( ImageEnView1.CurrentLayer );
txtLayer.Font.Size := 54;
txtLayer.Font.Style := [fsBold];
txtLayer.TextStyling.BorderWidth := 0;
txtLayer.TextStyling.FillTransparency1 := 0; // 100% transparent
txtLayer.TextStyling.FillTransparency2 := IEOpacityToAlpha( 70 ); // 70% opacity
txtLayer.TextStyling.FillGradient := gpgHorizontal;
txtLayer.TextStyling.FillColor2 := clYellow;
txtLayer.Text := 'ImageEn!';
txtLayer.SizeToText();
ImageEnView1.Update();





See Also

- SizeToText
- AutoSize
- TextOverflow
- RichText
- EnableFormatting