Back to Devexpress

Shape.HeightRelative Property

officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-shape-95719c6e.md

latest3.0 KB
Original Source

Shape.HeightRelative Property

Gets or sets the shape height relative to an element specified by the RelativeVerticalSize property.

Namespace : DevExpress.XtraRichEdit.API.Native

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

NuGet Package : DevExpress.RichEdit.Core

Declaration

csharp
float HeightRelative { get; set; }
vb
Property HeightRelative As Single

Property Value

TypeDescription
Single

A value that specifies the ratio of the shape height to the height of the specified element. A valid value is from 0 (0%) to 10 (1000%).

|

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

RelativeVerticalSize

Shape Interface

Shape Members

DevExpress.XtraRichEdit.API.Native Namespace