Back to Devexpress

Shape.RelativeHorizontalSize Property

officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-shape-974fa34b.md

latest3.9 KB
Original Source

Shape.RelativeHorizontalSize Property

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

Namespace : DevExpress.XtraRichEdit.API.Native

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

NuGet Package : DevExpress.RichEdit.Core

Declaration

csharp
ShapeRelativeHorizontalSize RelativeHorizontalSize { get; set; }
vb
Property RelativeHorizontalSize As ShapeRelativeHorizontalSize

Property Value

TypeDescription
ShapeRelativeHorizontalSize

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

|

Available values:

NameDescription
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:

csharp
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;
vb
Dim document As Document = wordProcessor.Document
' Create a rectangle.
Dim rectangle As Shape = 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

WidthRelative

Shape Interface

Shape Members

DevExpress.XtraRichEdit.API.Native Namespace