close #397
This commit is contained in:
1 parent
2f08667db8
commit
0cdd558e5d
12 files changed
+210
-30
No files matched your search
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
using HandyControl.Expression.Drawing;
|
||||
using HandyControl.Tools.Interop;
|
||||
|
||||
namespace HandyControl.Tools
|
||||
@@ -79,5 +80,25 @@ namespace HandyControl.Tools
|
||||
result.Transform(TransformFromDevice.Matrix);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static double RoundLayoutValue(double value, double dpiScale)
|
||||
{
|
||||
double newValue;
|
||||
|
||||
if (!MathHelper.AreClose(dpiScale, 1.0))
|
||||
{
|
||||
newValue = Math.Round(value * dpiScale) / dpiScale;
|
||||
if (double.IsNaN(newValue) || double.IsInfinity(newValue) || MathHelper.AreClose(newValue, double.MaxValue))
|
||||
{
|
||||
newValue = value;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
newValue = Math.Round(value);
|
||||
}
|
||||
|
||||
return newValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user