ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 How to create a TextLayer with a PerfectCircle Shape and the text in the center?
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

PeterPanino

935 Posts

Posted - Dec 08 2022 :  02:29:48  Show Profile  Reply
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;


xequte

38715 Posts

Posted - Dec 08 2022 :  23:57:01  Show Profile  Reply
Hi Peter

Please change:
TIETextLayer(ImageEnView1.CurrentLayer).Layout := TIELayout(iejCenter);

To:
TIETextLayer(ImageEnView1.CurrentLayer).Layout := ielCenter;

https://www.imageen.com/help/TIETextLayer.Layout.html

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

PeterPanino

935 Posts

Posted - Dec 09 2022 :  03:57:47  Show Profile  Reply
Hi Nigel

You are right: ielCenter is correct.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: