Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Wednesday, February 15, 2017 4:05:03 AM(UTC)

maneka  
maneka

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


 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Monday, February 20, 2017 9:56:06 AM(UTC)

Roberto  
Roberto

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:

UserPostedImage
Roberto Rodriguez
Developer Support Engineer
LEAD Technologies, Inc.

LEAD Logo
thanks 1 user thanked Roberto for this useful post.
maneka on 3/1/2017(UTC)
 
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.043 seconds.