Esempio n. 1
0
        public static void ShowAll()
        {
            int N = All.Length;

            Console.WriteLine($"There {((N > 1) ? "are" : "is")} {N} SCREEN{((N > 1) ? "S" : "")}:");
            int i = 0;

            foreach (var S in All)
            {
                var DPIEffective = StaticStuff.GetDpi(S.screen, StaticStuff.DpiType.Effective);
                var R            = S.R;

                Console.WriteLine(
                    $"   {i}: ({R.Left},{R.Top})-({R.Right},{R.Bottom})   Size:({R.Width},{R.Height}) " +
                    $"L({AsString(S.ToLeft)}),R({AsString(S.ToRight)}),A({AsString(S.Above)}),B({AsString(S.Below)})    " +
                    $"DPI(Raw/Eff/Ang): {StaticStuff.GetDpi(S.screen, StaticStuff.DpiType.Raw)}/{DPIEffective}/{StaticStuff.GetDpi(S.screen, StaticStuff.DpiType.Angular)}  " +
                    $"Screen Scaling: {Math.Round(DPIEffective / 96.0 * 100)}%   \r"); //  {S.DeviceName}     \r");
                ++i;
            }
            Console.WriteLine($"Rtmost({AsString(RightMost)}), Lfmost({AsString(LeftMost)}), " +
                              $"Topmost({AsString(TopMost)}), Btmost({AsString(BottomMost)})   " +
                              $"BoundingBox{BoundingBox}");
        }
Esempio n. 2
0
        // May want to update the above routine, which arbitrarily selects the monitor that
        // happens to come first in the for() loop. We should probably do a little extra work,
        // and select the monitor that is closest to the mouse position.

        // Find the monitor that is closest to the point.
        //public static SnagScreen ScreenInDirection()
        //{
        //}

        // Find the best point to "wrap" around the cursor, either horizontally or
        // vertically. We consider only the "OuterMost" screens. For instance, if
        // the mouse is moving to the left, we consider only the screens in the
        // RightMost[] array.
        public static Point WrapPoint(Point Dir, Point Cursor)
        {
            int        DistClosest = int.MaxValue;
            SnagScreen WS          = null; // Our "wrap screen".

            if (Dir.X != 0)
            {
                // Find closest Left- or Right-most screen, in Y direction.
                foreach (var S in (Dir.X == 1 ? LeftMost : RightMost))
                {
                    int dist = Math.Abs(StaticStuff.OutsideYDistance(S.R, Cursor));
                    if (dist < DistClosest)
                    {
                        DistClosest = dist;
                        WS          = S;
                    }
                }
                return(WS.R.ClosestBoundaryPoint(new Point(Dir.X == 1 ? WS.R.Left : WS.R.Right, Cursor.Y)));
            }

            // We should never get here, but if we do, just return the current
            // Cursor location.
            return(Cursor);
        }