labels Property

Summary

Gets a dictionary of AnnLabel objects used by this AnnObject.

Syntax
TypeScript
JavaScript
Object.defineProperty(AnnObject.prototype, 'labels', 
	get: function() 
) 
labels: { [key: string]: AnnLabel }; // read-only 

Property Value

A dictionary of the AnnLabel objects used by this AnnObject.

Remarks

By default, AnnObject creates a default AnnLabel object with AnnLabel.IsVisible set to false and adds it to Labels with key name equals to "AnnObjectName".

Example
TypeScript
JavaScript
var inch = 720.0; 
 
// Get the container 
var container = this._automation.get_container(); 
 
// Add a blue on yellow rectangle from 1in 1in to 2in 2in 
var rectObj = new lt.Annotations.Engine.AnnRectangleObject(); 
rectObj.set_rect(lt.LeadRectD.create(1 * inch, 1 * inch, 1 * inch, 1 * inch)); 
rectObj.set_stroke(lt.Annotations.Engine.AnnStroke.create(lt.Annotations.Engine.AnnSolidColorBrush.create("blue"), lt.LeadLengthD.create(1))); 
rectObj.set_fill(lt.Annotations.Engine.AnnSolidColorBrush.create("yellow")); 
rectObj.set_hyperlink("https://www.leadtools.com/downloads/demos.htm"); 
 
// Update the object name label 
var label = rectObj.get_labels()["AnnObjectName"]; 
label.set_isVisible(true); 
label.set_offset(lt.LeadPointD.create(-100, -25)); 
label.set_foreground(lt.Annotations.Engine.AnnSolidColorBrush.create("white")); 
label.set_background(lt.Annotations.Engine.AnnSolidColorBrush.create("rgba(0, 0, 0, 0.5)")); 
label.set_text("My object"); 
 
// Add it to the container 
container.get_children().add(rectObj); 
 
// Render the container 
this._automation.invalidate(lt.LeadRectD.empty); 
const inch: number = 720.0; 
 
// Get the container 
const container: lt.Annotations.Engine.AnnContainer = this._automation.container; 
 
// Add a blue on yellow rectangle from 1in 1in to 2in 2in 
const rectObj: lt.Annotations.Engine.AnnRectangleObject = new lt.Annotations.Engine.AnnRectangleObject(); 
rectObj.set_rect(lt.LeadRectD.create(1 * inch, 1 * inch, 1 * inch, 1 * inch)); 
rectObj.set_stroke(lt.Annotations.Engine.AnnStroke.create(lt.Annotations.Engine.AnnSolidColorBrush.create("blue"), lt.LeadLengthD.create(1))); 
rectObj.set_fill(lt.Annotations.Engine.AnnSolidColorBrush.create("yellow")); 
rectObj.set_hyperlink("https://www.leadtools.com/downloads/demos.htm"); 
 
// Update the object name label 
const label: lt.Annotations.Engine.AnnLabel = rectObj.labels["AnnObjectName"]; 
label.isVisible = true; 
label.offset = lt.LeadPointD.create(-100, -25); 
label.foreground = lt.Annotations.Engine.AnnSolidColorBrush.create("white"); 
label.background = lt.Annotations.Engine.AnnSolidColorBrush.create("rgba(0, 0, 0, 0.5)"); 
label.text = "My object"; 
 
// Add it to the container 
container.children.add(rectObj); 
 
// Render the container 
this._automation.invalidate(lt.LeadRectD.empty); 

Requirements

Target Platforms

Help Version 20.0.2019.3.11
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2019 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Annotations.Engine Assembly