protected override object ConvertCore(object value, Type targetType, object parameter, CultureInfo culture) { var roundingMode = RoundingMode.MidPointFromZero; if (value is double) { var dblValue = (double)value; return(DoubleUtils.Round(dblValue, Digits, roundingMode)); } if (value is Point) { var ptValue = (Point)value; return(PointUtils.Round(ptValue, roundingMode, Digits)); } if (value is Size) { var szValue = (Size)value; return(SizeUtils.Round(szValue, roundingMode, Digits)); } if (value is Rect) { var rcValue = (Rect)value; return(RectUtils.Round(rcValue, roundingMode, Digits)); } return(value); }
internal static Size Round(this Size size, RoundingMode roundingMode, int digits = 0) { return(SizeUtils.Round(size, roundingMode, digits)); }
public static Size Round(this Size size, int digits = 0) { return(SizeUtils.Round(size, digits)); }