Exemple #1
0
        public static Eto.Drawing.PointF GetLogicalLocation(this swf.Screen screen)
        {
            var   bounds = screen.Bounds;
            float x, y;

            if (bounds.X > 0)
            {
                var left = screen.FindLeftScreen();
                if (left != null)
                {
                    x = GetLogicalLocation(left).X + GetLogicalSize(left).Width;
                }
                else
                {
                    x = bounds.X / GetMaxLogicalPixelSize();
                }
            }
            else if (bounds.X < 0)
            {
                var right = screen.FindRightScreen();
                if (right != null)
                {
                    x = GetLogicalLocation(right).X - GetLogicalSize(screen).Width;
                }
                else
                {
                    x = bounds.X / screen.GetLogicalPixelSize();
                }
            }
            else
            {
                x = bounds.X;
            }
            if (bounds.Y > 0)
            {
                var top = screen.FindTopScreen();
                if (top != null)
                {
                    y = GetLogicalLocation(top).Y + GetLogicalSize(top).Height;
                }
                else
                {
                    y = bounds.Y / GetMaxLogicalPixelSize();
                }
            }
            else if (bounds.Y < 0)
            {
                var bottom = screen.FindBottomScreen();
                if (bottom != null)
                {
                    y = GetLogicalLocation(bottom).Y - GetLogicalSize(screen).Height;
                }
                else
                {
                    y = bounds.Y / screen.GetLogicalPixelSize();
                }
            }
            else
            {
                y = bounds.Y;
            }
            return(new Eto.Drawing.PointF(x, y));
        }