.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+

Shape.RelativeVerticalPosition Property

Gets or sets the element to which the shape's vertical position is relative.

Namespace: DevExpress.XtraRichEdit.API.Native

Assembly: DevExpress.RichEdit.v20.2.Core.dll

Declaration

ShapeRelativeVerticalPosition RelativeVerticalPosition { get; set; }
Property RelativeVerticalPosition As ShapeRelativeVerticalPosition

Property Value

Type Description
ShapeRelativeVerticalPosition

Defines the element relative to which the shape is positioned vertically.

Remarks

Use one of the following methods to specify the position of a floating shape or picture in a document.

Align a Shape Horizontally and Vertically

Alignment Specify the alignment type Relative to
Horizontal Shape.HorizontalAlignment Shape.RelativeHorizontalPosition
Vertical Shape.VerticalAlignment Shape.RelativeVerticalPosition

The following example displays a rectangle in the center of the page below the top margin:

Document document = wordProcessor.Document;
// Create a rectangle.
Shape rectangle = document.Shapes.InsertShape(document.Range.Start, ShapeGeometryPreset.Rectangle, new SizeF(500, 300));
// Align the rectangle horizontally and vertically.
rectangle.RelativeHorizontalPosition = ShapeRelativeHorizontalPosition.Page;
rectangle.HorizontalAlignment = ShapeHorizontalAlignment.Center;
rectangle.RelativeVerticalPosition = ShapeRelativeVerticalPosition.Margin;
rectangle.VerticalAlignment = ShapeVerticalAlignment.Top;

Specify the Absolute Position

Position Define the offset Relative to
Horizontal Shape.OffsetX Shape.RelativeHorizontalPosition
Vertical Shape.OffsetY Shape.RelativeVerticalPosition

The Shape.Offset property specifies both the horizontal and vertical positions.

NOTE

The Offset properties are in effect when the Shape.HorizontalAlignment and Shape.VerticalAlignment properties are set to None.

The example below creates a rectangle and places it on the page as follows:

  • the absolute horizontal position is two inches to the right of the page;

  • the absolute vertical position is one inch below the page.

Document document = wordProcessor.Document;
// Set the measurement unit to inches.
document.Unit = DevExpress.Office.DocumentUnit.Inch;
// Create a rectangle.
Shape rectangle = document.Shapes.InsertShape(document.Range.Start, ShapeGeometryPreset.Rectangle, new SizeF(2.5f, 1.5f));
// Specify the rectangle position on the page.
rectangle.RelativeHorizontalPosition = ShapeRelativeHorizontalPosition.Page;
rectangle.OffsetX = 2;
rectangle.RelativeVerticalPosition = ShapeRelativeVerticalPosition.Page;
rectangle.OffsetY = 1;

Specify the Relative Position

Position Define the offset (in percentage) Relative to
Horizontal Shape.OffsetXRelative Shape.RelativeHorizontalPosition
Vertical Shape.OffsetYRelative Shape.RelativeVerticalPosition

The Shape.OffsetRelative property specifies both the horizontal and vertical relative positions.

NOTE

The OffsetRelative properties are in effect when the Shape.HorizontalAlignment and Shape.VerticalAlignment properties are set to None.

The example below creates a rectangle and places it on the page as follows:

  • the horizontal offset is equal to 20% of the page width,

  • the vertical offset is equal to 10% of the page height.

Document document = wordProcessor.Document;
// Set the measurement unit to inches.
document.Unit = DevExpress.Office.DocumentUnit.Inch;
// Create a rectangle.
Shape rectangle = document.Shapes.InsertShape(document.Range.Start, ShapeGeometryPreset.Rectangle, new SizeF(2.5f, 1.5f));
// Specify the rectangle position on the page.
rectangle.RelativeHorizontalPosition = ShapeRelativeHorizontalPosition.Page;
rectangle.OffsetXRelative = 0.2f;
rectangle.RelativeVerticalPosition = ShapeRelativeVerticalPosition.Page;
rectangle.OffsetYRelative = 0.1f;
See Also