Back to Devexpress

Shape.OffsetX Property

officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-shape-8b5a6dc2.md

latest3.9 KB
Original Source

Shape.OffsetX Property

Specifies the absolute 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 OffsetX { get; set; }
vb
Property OffsetX As Single

Property Value

TypeDescription
Single

The horizontal offset in measurement units specified by the Document.Unit property.

|

Remarks

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

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.

  • 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.OffsetX = 2;
rectangle.RelativeVerticalPosition = ShapeRelativeVerticalPosition.Page;
rectangle.OffsetY = 1;
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.OffsetX = 2
rectangle.RelativeVerticalPosition = ShapeRelativeVerticalPosition.Page
rectangle.OffsetY = 1

See Also

RelativeHorizontalPosition

OffsetXRelative

Shape Interface

Shape Members

DevExpress.XtraRichEdit.API.Native Namespace