Gets or sets the location and size of the containing block of the shape.
[Visual Basic]Public Property Bounds As
RectangleF Remarks
For a top-level shape, the value is in points and relative to the shape anchor.
For shapes in a group, the value is in the coordinate space and units of the parent group.
Example
Creates two line shapes. One line goes from top left to bottom right. Another line goes from bottom left to top right.
[C#]
Document doc = new Document();
// The lines will cros 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);
lineA.Bounds = new RectangleF(0, 0, pageWidth, pageHeight);
lineA.RelativeHorizontalPosition = RelativeHorizontalPosition.Page;
lineA.RelativeVerticalPosition = RelativeVerticalPosition.Page;
doc.FirstSection.Body.FirstParagraph.AppendChild(lineA);
// This line goes from bottom left to top right because we flipped it.
Shape lineB = new Shape(doc, ShapeType.Line);
lineB.Bounds = new RectangleF(0, 0, pageWidth, pageHeight);
lineB.FlipOrientation = FlipOrientation.Horizontal;
lineB.RelativeHorizontalPosition = RelativeHorizontalPosition.Page;
lineB.RelativeVerticalPosition = RelativeVerticalPosition.Page;
doc.FirstSection.Body.FirstParagraph.AppendChild(lineB);
doc.Save(MyDir + "Shape.LineFlipOrientation Out.doc");
[Visual Basic]
Dim doc As Document = New Document()
' The lines will cros the whole page.
Dim pageWidth As Single = CSng(doc.FirstSection.PageSetup.PageWidth)
Dim pageHeight As Single= CSng(doc.FirstSection.PageSetup.PageHeight)
' This line goes from top left to bottom right by default.
Dim lineA As Shape = New Shape(doc, ShapeType.Line)
lineA.Bounds = New RectangleF(0, 0, pageWidth, pageHeight)
lineA.RelativeHorizontalPosition = RelativeHorizontalPosition.Page
lineA.RelativeVerticalPosition = RelativeVerticalPosition.Page
doc.FirstSection.Body.FirstParagraph.AppendChild(lineA)
' This line goes from bottom left to top right because we flipped it.
Dim lineB As Shape = New Shape(doc, ShapeType.Line)
lineB.Bounds = New RectangleF(0, 0, pageWidth, pageHeight)
lineB.FlipOrientation = FlipOrientation.Horizontal
lineB.RelativeHorizontalPosition = RelativeHorizontalPosition.Page
lineB.RelativeVerticalPosition = RelativeVerticalPosition.Page
doc.FirstSection.Body.FirstParagraph.AppendChild(lineB)
doc.Save(MyDir & "Shape.LineFlipOrientation Out.doc")
See Also
ShapeBase Class | Aspose.Words.Drawing Namespace