fixed a bug of window
This commit is contained in:
1 parent
b84db8512f
commit
2c0573518b
38 files changed
+540
-592
No files matched your search
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace HandyControl.Tools
|
||||
{
|
||||
internal class DpiHelper
|
||||
{
|
||||
[ThreadStatic]
|
||||
private static Matrix _transformToDip;
|
||||
|
||||
public static Point DevicePixelsToLogical(Point devicePoint, double dpiScaleX, double dpiScaleY)
|
||||
{
|
||||
_transformToDip = Matrix.Identity;
|
||||
_transformToDip.Scale(1d / dpiScaleX, 1d / dpiScaleY);
|
||||
return _transformToDip.Transform(devicePoint);
|
||||
}
|
||||
|
||||
public static Size DeviceSizeToLogical(Size deviceSize, double dpiScaleX, double dpiScaleY)
|
||||
{
|
||||
Point pt = DevicePixelsToLogical(new Point(deviceSize.Width, deviceSize.Height), dpiScaleX, dpiScaleY);
|
||||
|
||||
return new Size(pt.X, pt.Y);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user