class Util
{
#if METRO
+ public static void GetDpi(out float dpix, out float dpiy)
+ {
+ dpix = Windows.Graphics.Display.DisplayInformation.GetForCurrentView().LogicalDpi;
+ dpiy = Windows.Graphics.Display.DisplayInformation.GetForCurrentView().LogicalDpi;
+ }
+
+ public static double GetScale()
+ {
+ float dpi;
+ Util.GetDpi(out dpi, out dpi);
+ return dpi / 96.0;
+ }
+
public static Windows.Foundation.Point GetClientPoint(Windows.Foundation.Point screen, Windows.UI.Xaml.UIElement element)
{
//Windows10以降では補正する必要がある
var gt = element.TransformToVisual(element);
return gt.TransformPoint(screen);
}
- public static Windows.Foundation.Point GetScreentPoint(Windows.Foundation.Point client, Windows.UI.Xaml.UIElement element)
+ public static Point GetScreentPoint(Point client, Windows.UI.Xaml.UIElement element)
{
//ウィンドウ内での絶対座標を取得する
var gt = element.TransformToVisual(null);
- Windows.Foundation.Point screenPoint = gt.TransformPoint(client);
+ Point screenPoint = gt.TransformPoint(client);
//Windows10以降では補正する必要がある
Windows.Foundation.Rect win_rect = Windows.UI.Xaml.Window.Current.CoreWindow.Bounds;