This topic and its replies were posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Wednesday, February 15, 2017 4:05:03 AM(UTC)
Groups: Registered
Posts: 17
Thanks: 1 times
Hi
I have the following scenario where if I add a annotation i.e. a free hand drawing, polygon, rectangle etc. I require a label to be attached to this shape. I did notice that the annotation shapes have a label property which can be made visible however it is positioned in the left corner. My question is, is it possible to set the co-ordinates of this shape to be the rotateCentre co-ordinates of the shape.
I have used the following code to set the label
var point = annRect.rotateCenter;
var label = annRect.get_labels()["AnnObjectName"];
label.set_isVisible(true);
label.set_foreground(lt.Annotations.Core.AnnSolidColorBrush.create("white"));
label.set_background(lt.Annotations.Core.AnnSolidColorBrush.create("red"));
label.set_text("1");
label.set_originalPosition(point);
annRect.labels.AnnObjectName = label;
Any help provided is appriciated
Thank you
Maneka
#2
Posted
:
Monday, February 20, 2017 9:56:06 AM(UTC)
Groups: Registered, Tech Support, Administrators
Posts: 39
Thanks: 2 times
Was thanked: 3 time(s) in 3 post(s)
Hi maneka,
You can achieve this using the following code:
Code: AnnLabel label = e.Object.Labels["AnnObjectName"];
label.IsVisible = true;
label.Offset = LeadPointD.Create(e.Object.RotateCenter.X - e.Object.Bounds.Left, e.Object.RotateCenter.Y - e.Object.Bounds.Top);
label.OffsetHeight = false;
label.Text = e.Object.FriendlyName;
Here is a screenshot:

Roberto Rodriguez
Developer Support Engineer
LEAD Technologies, Inc.


1 user thanked Roberto for this useful post.