Skip to main content

DrawingObject.Offset Property

Gets or sets the absolute position of a shape on the page.

Namespace: DevExpress.XtraRichEdit.API.Native

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

NuGet Packages: DevExpress.RichEdit.Core, DevExpress.Win.Navigation

Declaration

PointF Offset { get; set; }

Property Value

Type Description
PointF

An object that specifies the horizontal and vertical offsets in measurement units defined by the Document.Unit property.

Remarks

Top-Level Shapes

Use the Offset property to specify the absolute position of a floating shape on the page relative to the document elements defined by the Shape.RelativeHorizontalPosition and Shape.RelativeVerticalPosition properties.

Note

The Offset property is 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.RelativeVerticalPosition = ShapeRelativeVerticalPosition.Page;
rectangle.Offset = new PointF(2f, 1f);

Nested Shapes

Use a nested shape’s Offset property to modify its position relative to the top left corner of a parent object (a shape group or a drawing canvas).

The following code snippets (auto-collected from DevExpress Examples) contain references to the Offset property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also