Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

Shape.WidthRelative Property

Gets or sets the shape width relative to an element specified by the RelativeHorizontalSize property.

Namespace: DevExpress.XtraRichEdit.API.Native

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

NuGet Package: DevExpress.RichEdit.Core

#Declaration

float WidthRelative { get; set; }

#Property Value

Type Description
Single

A value that specifies the ratio of the shape width to the width 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:

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