Skip to main content
.NET Framework 4.5.2+

Shape.HorizontalAlignment Property

Specifies how a shape is aligned horizontally.

Namespace: DevExpress.XtraRichEdit.API.Native

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

NuGet Package: DevExpress.RichEdit.Core

Declaration

ShapeHorizontalAlignment HorizontalAlignment { get; set; }

Property Value

Type Description
ShapeHorizontalAlignment

An enumeration member that specifies the shape’s horizontal alignment.

Remarks

Use the following properties to align a shape on the page:

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;

Set the alignment values to None and use the Shape.OffsetX and Shape.OffsetY properties to specify the absolute position of the shape on the page.

The following code snippets (auto-collected from DevExpress Examples) contain references to the HorizontalAlignment 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