ShapeBaseBoundsInPoints Property

Gets the location and size of the containing block of the shape in points, relative to the anchor of the topmost shape.

Namespace:  Aspose.Words.Drawing
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.3
Syntax
public RectangleF BoundsInPoints { get; }

Property Value

Type: RectangleF
Examples
Shows how to create line shapes and set specific location and size.
Document doc = new Document();

// The lines will cross the whole page
float pageWidth = (float) doc.FirstSection.PageSetup.PageWidth;
float pageHeight = (float) doc.FirstSection.PageSetup.PageHeight;

// This line goes from top left to bottom right by default
Shape lineA = new Shape(doc, ShapeType.Line)
{
    Bounds = new RectangleF(0, 0, pageWidth, pageHeight),
    RelativeHorizontalPosition = RelativeHorizontalPosition.Page,
    RelativeVerticalPosition = RelativeVerticalPosition.Page
};

Assert.AreEqual(new RectangleF(0, 0, pageWidth, pageHeight), lineA.BoundsInPoints);

// This line goes from bottom left to top right because we flipped it
Shape lineB = new Shape(doc, ShapeType.Line)
{
    Bounds = new RectangleF(0, 0, pageWidth, pageHeight),
    FlipOrientation = FlipOrientation.Horizontal,
    RelativeHorizontalPosition = RelativeHorizontalPosition.Page,
    RelativeVerticalPosition = RelativeVerticalPosition.Page
};

Assert.AreEqual(new RectangleF(0, 0, pageWidth, pageHeight), lineB.BoundsInPoints);

// Add lines to the document
doc.FirstSection.Body.FirstParagraph.AppendChild(lineA);
doc.FirstSection.Body.FirstParagraph.AppendChild(lineB);

doc.Save(ArtifactsDir + "Shape.LineFlipOrientation.doc");
See Also