private static RectangleDouble ScreenToSystemWindow(ScreenRectangle rectOnScreen, SystemWindow containingWindow) { ScreenRectangle screenPosition = new ScreenRectangle() { Left = (int)rectOnScreen.Left, Top = (int)rectOnScreen.Top, Right = (int)rectOnScreen.Right, Bottom = (int)rectOnScreen.Bottom, }; WidgetForWindowsFormsAbstract mappingWidget = containingWindow.Parent as WidgetForWindowsFormsAbstract; screenPosition.Left -= mappingWidget.WindowsFormsWindow.Location.X; screenPosition.Top -= (mappingWidget.WindowsFormsWindow.Location.Y + mappingWidget.WindowsFormsWindow.TitleBarHeight); screenPosition.Left -= mappingWidget.WindowsFormsWindow.Location.X; screenPosition.Bottom -= (mappingWidget.WindowsFormsWindow.Location.Y + mappingWidget.WindowsFormsWindow.TitleBarHeight); screenPosition.Top = (int)containingWindow.Height - screenPosition.Top; screenPosition.Bottom = (int)containingWindow.Height - screenPosition.Bottom; return(new RectangleDouble() { Left = screenPosition.Left, Bottom = screenPosition.Bottom, Right = screenPosition.Right, Top = screenPosition.Top, }); }
private static Point2D SystemWindowToScreen(Point2D pointOnWindow, SystemWindow containingWindow) { Point2D screenPosition = new Point2D(pointOnWindow.x, (int)containingWindow.Height - pointOnWindow.y); WidgetForWindowsFormsAbstract mappingWidget = containingWindow.Parent as WidgetForWindowsFormsAbstract; screenPosition.x += mappingWidget.WindowsFormsWindow.Location.X; screenPosition.y += mappingWidget.WindowsFormsWindow.Location.Y + mappingWidget.WindowsFormsWindow.TitleBarHeight; return(screenPosition); }
private static Point2D ScreenToSystemWindow(Point2D pointOnScreen, SystemWindow containingWindow) { Point2D screenPosition = pointOnScreen; WidgetForWindowsFormsAbstract mappingWidget = containingWindow.Parent as WidgetForWindowsFormsAbstract; screenPosition.x -= mappingWidget.WindowsFormsWindow.Location.X; screenPosition.y -= (mappingWidget.WindowsFormsWindow.Location.Y + mappingWidget.WindowsFormsWindow.TitleBarHeight); screenPosition.y = (int)containingWindow.Height - screenPosition.y; return(screenPosition); }