Skip to main content
A newer version of this page is available. .
.NET Framework 4.5.2+

Shape.HorizontalAlignment Property

Gets or sets how the shape is positioned horizontally.

Namespace: DevExpress.XtraRichEdit.API.Native

Assembly: DevExpress.RichEdit.v19.1.Core.dll

Declaration

ShapeHorizontalAlignment HorizontalAlignment { get; set; }

Property Value

Type Description
ShapeHorizontalAlignment

A ShapeHorizontalAlignment enumeration member that specifies the shape’s horizontal position.

Remarks

The shape can be positioned horizontally relative to the area specified by the Shape.RelativeHorizontalPosition. If the alignment is set to ShapeHorizontalAlignment.None, the shape is positioned at a distance explicitly specified in the Shape.Offset property.

This example moves a floating object to a position where its upper left corner is located at 4.5 cm to the right of the left margin and 2 cm below the top margin.

Document document = server.Document;
document.LoadDocument("Documents\\Grimm.docx", DocumentFormat.OpenXml);
document.Unit = DevExpress.Office.DocumentUnit.Centimeter;
Shape myPicture = document.Shapes[1];
// Clear the qualitative positioning to allow positioning by specifying the numerical offset. 
myPicture.HorizontalAlignment = ShapeHorizontalAlignment.None;
myPicture.VerticalAlignment = ShapeVerticalAlignment.None;
// Specify the reference item for positioning.
myPicture.RelativeHorizontalPosition = ShapeRelativeHorizontalPosition.LeftMargin;
myPicture.RelativeVerticalPosition = ShapeRelativeVerticalPosition.TopMargin;
// Specify the offset value.
myPicture.Offset = new System.Drawing.PointF(4.5f, 2.0f);

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