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

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 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?

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
PeterPanino Posted - Dec 08 2022 : 02:29:48
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;


2   L A T E S T    R E P L I E S    (Newest First)
PeterPanino Posted - Dec 09 2022 : 03:57:47
Hi Nigel

You are right: ielCenter is correct.
xequte Posted - Dec 08 2022 : 23:57:01
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