UnitConverter.CentimetersToTwips(Single) Method
In This Article
Converts a value from centimeters to twips.
Namespace: DevExpress.Blazor.RichEdit
Assembly: DevExpress.Blazor.RichEdit.v24.2.dll
NuGet Package: DevExpress.Blazor.RichEdit
#Declaration
C#
public static int CentimetersToTwips(
float value
)
#Parameters
Name | Type | Description |
---|---|---|
value | Single | The value in centimeters. |
#Returns
Type | Description |
---|---|
Int32 | The value in twips. |
#Remarks
The following code snippet changes an inline image‘s actual size.
Razor
<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;
InlineImage firstInlineImage = await documentAPI.InlineImages.GetAsync(0);
await firstInlineImage.ChangePropertiesAsync(properties => {
if (firstInlineImage.ActualSize.Height != UnitConverter.CentimetersToTwips(5)) {
properties.ActualSize.Height = UnitConverter.CentimetersToTwips(5);
properties.ActualSize.Width = UnitConverter.CentimetersToTwips(5);
}
});
}
catch (OperationCanceledException e) {
Console.WriteLine($"{nameof(OperationCanceledException)} thrown with message: {e.Message}");
}
}
See Also