From c5eb72712acef17c9a3cfe08b835f2c6472bddfe Mon Sep 17 00:00:00 2001 From: konekoneko Date: Sat, 12 Nov 2016 14:03:01 +0530 Subject: [PATCH] =?utf8?q?UWP=E7=89=88=E3=81=A7=E5=A4=89=E6=8F=9B=E5=80=99?= =?utf8?q?=E8=A3=9C=E3=81=AE=E4=BD=8D=E7=BD=AE=E3=81=8C=E3=81=9A=E3=82=8C?= =?utf8?q?=E3=82=8B=E3=83=90=E3=82=B0=E3=82=92=E4=BF=AE=E6=AD=A3=E3=81=97?= =?utf8?q?=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- Core/Util.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Core/Util.cs b/Core/Util.cs index 987fe51..255de09 100644 --- a/Core/Util.cs +++ b/Core/Util.cs @@ -40,7 +40,7 @@ namespace FooEditEngine Windows.Foundation.Rect win_rect = Windows.UI.Xaml.Window.Current.CoreWindow.Bounds; screen = screen.Offset(-win_rect.X, -win_rect.Y); - var gt = element.TransformToVisual(element); + var gt = Windows.UI.Xaml.Window.Current.Content.TransformToVisual(element); return gt.TransformPoint(screen); } @@ -54,8 +54,7 @@ namespace FooEditEngine public static Point GetScreentPoint(Point client, Windows.UI.Xaml.UIElement element) { //ウィンドウ内での絶対座標を取得する - var gt = element.TransformToVisual(element); - Point screenPoint = gt.TransformPoint(client); + Point screenPoint = GetPointInWindow(client, element); //Windows10以降では補正する必要がある Windows.Foundation.Rect win_rect = Windows.UI.Xaml.Window.Current.CoreWindow.Bounds; @@ -70,13 +69,13 @@ namespace FooEditEngine screen.X -= win_rect.X; screen.Y -= win_rect.Y; - var gt = element.TransformToVisual(element); + var gt = Windows.UI.Xaml.Window.Current.Content.TransformToVisual(element); return gt.TransformBounds(screen); } public static Windows.Foundation.Rect GetScreentRect(Windows.Foundation.Rect client, Windows.UI.Xaml.UIElement element) { //ウィンドウ内での絶対座標を取得する - var gt = element.TransformToVisual(element); + var gt = element.TransformToVisual(null); Windows.Foundation.Rect screenRect = gt.TransformBounds(client); //Windows10以降では補正する必要がある -- 2.11.0