officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-shape-7b34448b.md
Specifies how a shape is aligned vertically.
Namespace : DevExpress.XtraRichEdit.API.Native
Assembly : DevExpress.RichEdit.v25.2.Core.dll
NuGet Package : DevExpress.RichEdit.Core
ShapeVerticalAlignment VerticalAlignment { get; set; }
Property VerticalAlignment As ShapeVerticalAlignment
| Type | Description |
|---|---|
| ShapeVerticalAlignment |
An enumeration member that specifies the shape’s vertical alignment.
|
Available values:
| Name | Description |
|---|---|
| None |
The Shape.OffsetY property specifies the shape’s position relative to the element defined by the Shape.RelativeVerticalPosition property.
| | Top |
The shape is aligned to the top of the element defined by the Shape.RelativeVerticalPosition property.
| | Center |
The shape is centered relative to the element defined by the Shape.RelativeVerticalPosition property.
| | Bottom |
The shape is aligned to the bottom of the element defined by the Shape.RelativeVerticalPosition property.
| | Inside |
The shape is aligned to the top of the element defined by the Shape.RelativeVerticalPosition property on odd pages, and is aligned to the bottom of the specified element on even pages.
The Rich Text Editor aligns the shape to the top of the specified element for both odd and even pages.
| | Outside |
The shape is aligned to the bottom of the element defined by the Shape.RelativeVerticalPosition property on odd pages, and is aligned to the top of the specified element on even pages.
The Rich Text Editor aligns the shape to the bottom of the specified element for both odd and even pages.
|
Use the following properties to align a shape on the page:
Shape.HorizontalAlignment - aligns the shape horizontally relative to the element defined by the Shape.RelativeHorizontalPosition property.
Shape.VerticalAlignment - aligns the shape vertically relative to the element defined by the Shape.RelativeVerticalPosition property.
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;
Dim document As Document = wordProcessor.Document
' Create a rectangle.
Dim rectangle As Shape = 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 VerticalAlignment 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.
winforms-richedit-document-api/CS/RichEditAPISample/CodeExamples/Shapes.cs#L30
myPicture.HorizontalAlignment = ShapeHorizontalAlignment.None;
myPicture.VerticalAlignment = ShapeVerticalAlignment.None;
// Specify the reference item for positioning.
wpf-richedit-document-api/CS/DXRichEditControlAPISample/CodeExamples/ShapesActions.cs#L41
myPicture.HorizontalAlignment = ShapeHorizontalAlignment.None;
myPicture.VerticalAlignment = ShapeVerticalAlignment.None;
// Specify the reference item for positioning.
word-document-api-examples/CS/CodeExamples/ShapesActions.cs#L57
myPicture.HorizontalAlignment = ShapeHorizontalAlignment.None;
myPicture.VerticalAlignment = ShapeVerticalAlignment.None;
winforms-richedit-document-api/VB/RichEditAPISample/CodeExamples/Shapes.vb#L27
myPicture.HorizontalAlignment = DevExpress.XtraRichEdit.API.Native.ShapeHorizontalAlignment.None
myPicture.VerticalAlignment = DevExpress.XtraRichEdit.API.Native.ShapeVerticalAlignment.None
' Specify the reference item for positioning.
wpf-richedit-document-api/VB/DXRichEditControlAPISample/CodeExamples/ShapesActions.vb#L34
myPicture.HorizontalAlignment = ShapeHorizontalAlignment.None
myPicture.VerticalAlignment = ShapeVerticalAlignment.None
' Specify the reference item for positioning.
word-document-api-examples/VB/CodeExamples/ShapesActions.vb#L51
myPicture.HorizontalAlignment = DevExpress.XtraRichEdit.API.Native.ShapeHorizontalAlignment.None
myPicture.VerticalAlignment = DevExpress.XtraRichEdit.API.Native.ShapeVerticalAlignment.None
' The picture's horizontal position is relative to the left margin.
See Also