Skip to main content

RoundLayoutSizeUp Method

Rounds a size to integer values for layout purposes, compensating for high DPI screen coordinates by rounding the size up to the nearest pixel.

Definition

Namespace: Avalonia.Layout
Assembly: Avalonia.Base (in Avalonia.Base.dll)

public static Size RoundLayoutSizeUp(
Size size,
double dpiScaleX,
double dpiScaleY
)

Parameters

  Size
Input size.
  Double
DPI along x-dimension.
  Double
DPI along y-dimension.

Return Value

Size
Value of size that will be rounded under screen DPI.

Remarks

This is a layout helper method. It takes DPI into account and also does not return the rounded value if it is unacceptable for layout, e.g. Infinity or NaN. It's a helper associated with the UseLayoutRounding property and should not be used as a general rounding utility.

See Also

Reference

LayoutHelper Class
Avalonia.Layout Namespace