Skip to main content

Image.VerticalOffset Property

Gets the image’s offset from a vertical anchor element.

Namespace: DevExpress.Blazor.RichEdit

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

NuGet Package: DevExpress.Blazor.RichEdit

Declaration

public int VerticalOffset { get; }

Property Value

Type Description
Int32

The vertical offset in twips.

Remarks

Use any of the following properties to define a vertical position of an image relative to its vertical anchor element:

VerticalAlignment
Vertically aligns an image. If you set this property to a value different from None, the Rich Text Editor sets the VerticalOffset and VerticalRelativeOffset properties to 0.
VerticalOffset
Defines an image’s vertical offset in twips. If you set this property to a value different from 0, the Rich Text Editor sets the VerticalRelativeOffset property to 0.
VerticalRelativeOffset
Defines an image’s vertical offset in percentage.

Use the ChangePropertiesAsync method to change the vertical offset of the image. Use methods of the UnitConverter class to convert centimeters, inches, pixels, or points to twips.

<DxRichEdit @ref="richEdit" />

@code {
    DxRichEdit richEdit;
    Document documentAPI;
    @* ... *@
    /* Surround the code that contains an asynchronous operation with a try-catch block to handle
    the OperationCanceledException. This exception is thrown when an asynchronous operation is canceled. */
        try {
            documentAPI = richEdit.DocumentAPI;
            @* ... *@
            Image firstImage = await documentAPI.Images.GetAsync(0);
            @* ... *@
            await firstImage.ChangePropertiesAsync(properties => {
                if (firstImage.VerticalOffset == 0) {
                    properties.VerticalAlignment = FloatingObjectVerticalAlignment.None;
                    properties.VerticalOffset = UnitConverter.CentimetersToTwips(1);
                }
            });
            @* ... *@
        }
        catch (OperationCanceledException e) {
            Console.WriteLine($"{nameof(OperationCanceledException)} thrown with message: {e.Message}");
        }
}
See Also