Back to Devexpress

Shape.OffsetXRelative Property

officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-shape-7acb5bb7.md

latest4.0 KB
Original Source

Shape.OffsetXRelative Property

Specifies the horizontal position of a shape relative to an element defined by the RelativeHorizontalPosition property.

Namespace : DevExpress.XtraRichEdit.API.Native

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

NuGet Package : DevExpress.RichEdit.Core

Declaration

csharp
float OffsetXRelative { get; set; }
vb
Property OffsetXRelative As Single

Property Value

TypeDescription
Single

The offset (in percentage) relative to the specified element. Valid values range from -10 (-1000%) to 10 (1000%).

|

Remarks

Use the following properties to specify the relative position of a floating shape on the page:

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.

  • C#

  • VB.NET

csharp
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;
vb
Dim document As Document = wordProcessor.Document
' Set the measurement unit to inches.
document.Unit = DevExpress.Office.DocumentUnit.Inch
' Create a rectangle.
Dim rectangle As Shape = 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

RelativeHorizontalPosition

OffsetX

Shape Interface

Shape Members

DevExpress.XtraRichEdit.API.Native Namespace