Leadtools.Annotations.Core Namespace : AnnRectangleObject Class |
public class AnnRectangleObject : AnnObject, IAnnObjectCloneable
Public Class AnnRectangleObject Inherits AnnObject Implements IAnnObjectCloneable
public sealed class AnnRectangleObject : IAnnObjectCloneable
@interface LTAnnRectangleObject : LTAnnObject <NSCoding,NSCopying>
public class AnnRectangleObject extends AnnObject
function Leadtools.Annotations.Core.AnnRectangleObject()
The rectangle annotation object is a simple rectangle with a stroke and a fill.
Programmatically, the boundaries and location of the rectangle object can be controlled using the following properties:
The AnnRectangleObject class inherits a number of properties from the AnnObject class, providing support for font, stroke and fill characteristics. These properties are listed below:
The name of the rectangle object can be controlled using Labels property, inherited from the AnnObject class.
The following properties can also be used to programmatically set characteristics of an AnnRectangleObject:
using Leadtools.Annotations.Automation; using Leadtools.Annotations.Core; using Leadtools.Codecs; using Leadtools.WinForms; public void AnnCore_AnnRectangleObject() { // assumes _automation is valid double inch = 720.0; // Add a rectangle object AnnRectangleObject rectangleObj = new AnnRectangleObject(); // Set the points for the rectangle rectangleObj.Points.Add(LeadPointD.Create(1 * inch, 1 * inch)); rectangleObj.Points.Add(LeadPointD.Create(2 * inch, 1 * inch)); rectangleObj.Points.Add(LeadPointD.Create(2 * inch, 2 * inch)); rectangleObj.Points.Add(LeadPointD.Create(1 * inch, 2 * inch)); // Set the stroke rectangleObj.Stroke = AnnStroke.Create(AnnSolidColorBrush.Create("Red"), LeadLengthD.Create(3)); // Set the fill rectangleObj.Fill = AnnSolidColorBrush.Create("Green"); // Add the object to the automation container _automation.Container.Children.Add(rectangleObj); // Select the object _automation.SelectObject(rectangleObj); }
using Leadtools.Converters; using Leadtools.Annotations.Automation; using Leadtools.Controls; using Leadtools.Annotations.Core; using Leadtools.Codecs; [TestMethod] public void AnnCore_AnnRectangleObject() { // assumes _automation is valid double inch = 720.0; // Add a rectangle object AnnRectangleObject rectangleObj = new AnnRectangleObject(); // Set the points for the rectangle rectangleObj.Points.Add(LeadPointDHelper.Create(1 * inch, 1 * inch)); rectangleObj.Points.Add(LeadPointDHelper.Create(2 * inch, 1 * inch)); rectangleObj.Points.Add(LeadPointDHelper.Create(2 * inch, 2 * inch)); rectangleObj.Points.Add(LeadPointDHelper.Create(1 * inch, 2 * inch)); // Set the stroke rectangleObj.Stroke = AnnStroke.Create(AnnSolidColorBrush.Create("Red"), LeadLengthDHelper.Create(3)); // Set the fill rectangleObj.Fill = AnnSolidColorBrush.Create("Green"); // Add the object to the automation container _automation.Container.Children.Add(rectangleObj); // Select the object _automation.SelectObject(rectangleObj); }