I am trying to create a TextLayer with a PerfectCircle Shape and the text in the center:
procedure TForm1.ButtonClick(Sender: TObject);
begin
ImageEnView1.LayersAdd('1', 12, clWhite, 'Segoe UI');
TIETextLayer(ImageEnView1.CurrentLayer).HorzMargin := 0.10;
TIETextLayer(ImageEnView1.CurrentLayer).VertMargin := 0.10;
TIETextLayer(ImageEnView1.CurrentLayer).FillColor := clRed;
TIETextLayer(ImageEnView1.CurrentLayer).AutoSize := True;
TIETextLayer(ImageEnView1.CurrentLayer).BorderShape := iesEllipse;
end;
This is the result:
So how can I create a TextLayer with a PerfectCircle Shape and the text in the center?
Please see the attached mini demo project:
attach/PeterPanino/202212822839_TextLayerCircleShape.zip
1.84 KB
UPDATE: Centering now works after having added the Alignment and Layout Layer properties:
procedure TForm1.ButtonClick(Sender: TObject);
begin
ImageEnView1.LayersAdd('1', 12, clWhite, 'Segoe UI');
TIETextLayer(ImageEnView1.CurrentLayer).HorzMargin := 0.10;
TIETextLayer(ImageEnView1.CurrentLayer).VertMargin := 0.10;
TIETextLayer(ImageEnView1.CurrentLayer).FillColor := clRed;
TIETextLayer(ImageEnView1.CurrentLayer).AutoSize := True;
TIETextLayer(ImageEnView1.CurrentLayer).BorderShape := iesEllipse;
TIETextLayer(ImageEnView1.CurrentLayer).Alignment := iejCenter;
TIETextLayer(ImageEnView1.CurrentLayer).Layout := TIELayout(iejCenter); // (typecasting needed!)
end;
However, the Shape is still not a Perfect Circle! Is this because a PerfectCircle Shape is missing from the Shapes collection?
So how can I get a PERFECT CIRCLE?
UPDATE 2: I now finally get a perfect circle by setting the Layer Width value to the Layer Height value at the end:
procedure TForm1.ButtonClick(Sender: TObject);
begin
ImageEnView1.LayersAdd('1', 12, clWhite, 'Segoe UI');
TIETextLayer(ImageEnView1.CurrentLayer).HorzMargin := 0.10;
TIETextLayer(ImageEnView1.CurrentLayer).VertMargin := 0.10;
TIETextLayer(ImageEnView1.CurrentLayer).FillColor := clRed;
TIETextLayer(ImageEnView1.CurrentLayer).AutoSize := True;
TIETextLayer(ImageEnView1.CurrentLayer).BorderShape := iesEllipse;
TIETextLayer(ImageEnView1.CurrentLayer).Alignment := iejCenter;
TIETextLayer(ImageEnView1.CurrentLayer).Layout := TIELayout(iejCenter); // (typecasting needed!)
TIETextLayer(ImageEnView1.CurrentLayer).Width := TIETextLayer(ImageEnView1.CurrentLayer).Height;
end;