Skip to main content

Shape.RelativeHorizontalSize Property

Gets or sets the element relative to which the shape width is calculated.

Namespace: DevExpress.XtraRichEdit.API.Native

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

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

Declaration

ShapeRelativeHorizontalSize RelativeHorizontalSize { get; set; }

Property Value

Type Description
ShapeRelativeHorizontalSize

An enumeration member that specifies the element to which the shape width is relative.

Available values:

Name Description
Margin

The shape width is relative to the distance between the left and right margins.

Page

The shape width is relative to the page width.

LeftMargin

The shape width is relative to the left margin size.

RightMargin

The shape width is relative to the right margin width.

InsideMargin

The shape width is relative to the inside margin size (that is the right margin size for odd pages, and the left margin size for even pages).

The Rich Text Editor calculates the shape width relative to the right margin size for both odd and even pages.

OutsideMargin

The shape width is relative to the outside margin size (that is the left margin size for odd pages, and the right margin size for even pages).

The Rich Text Editor calculates the shape width relative to the left margin size for both odd and even pages.

Remarks

Use the following properties to resize a shape relative to a given document element, as a percentage:

The following example creates a rectangle and sets its width and height to 50% of the page size:

Document document = wordProcessor.Document;
// Create a rectangle.
Shape rectangle = document.Shapes.InsertShape(document.Range.Start, ShapeGeometryPreset.Rectangle);
// Set the rectangle width to 50% of the page width.
rectangle.RelativeHorizontalSize = ShapeRelativeHorizontalSize.Page;
rectangle.WidthRelative = 0.5f;
// Set the rectangle height to 50% of the page height.
rectangle.RelativeVerticalSize = ShapeRelativeVerticalSize.Page;
rectangle.HeightRelative = 0.5f;
See Also