Exemple #1
0
        public void AddRangeTest()
        {
            RangeData rangeData = new RangeData();

            rangeData.AddRange(100, 100);
            rangeData.Count.Is(1);
            rangeData.Range.Take(1).Is(new(int, int)[] { (100, 100) });
Exemple #2
0
        public void ClearTest()
        {
            RangeData rangeData = new RangeData();

            rangeData.AddRange(0, 1920);
            rangeData.Clear();
            rangeData.Count.Is(0);
        }
Exemple #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="direction">移動方向</param>
        /// <param name="warp"></param>
        /// <param name="x">X座標</param>
        /// <param name="y">Y座標</param>
        /// <returns></returns>
        private void MoveScreen(Direction direction, bool warp, ref int x, ref int y)
        {
            // 移動先 Screen 探索
            if (Screen.AllScreens.Length > 1)
            {
                range.Clear();
                int toX, toY;
                switch (direction)
                {
                case Direction.LeftUp:
                    break;

                case Direction.RightUp:
                    break;

                case Direction.LeftDown:
                    break;

                case Direction.RightDown:
                    break;

                case Direction.Left:
                    toX = screenBounds.X - 1;
                    foreach (var s in Screen.AllScreens)
                    {
                        if (toX == s.Bounds.X2() && screenBounds.Y <= s.Bounds.Y2() && screenBounds.Y2() >= s.Bounds.Y)
                        {
                            range.AddRange(s.Bounds.Y, s.Bounds.Width);
                        }
                    }
                    if (range.Count > 0)
                    {
                        // 移動先がある
                        x            = toX - confMargin;
                        y            = range.Convert(y, screenBounds.Y, screenBounds.Height);
                        screenBounds = Screen.FromPoint(new Point(x, y)).Bounds;
                        this.BeginInvoke((Action)(() => label1.Text = string.Format("{0}", screenBounds)));
                        return;
                    }
                    break;

                case Direction.Right:
                    toX = screenBounds.X2() + 1;
                    foreach (var s in Screen.AllScreens)
                    {
                        if (toX == s.Bounds.X && screenBounds.Y <= s.Bounds.Y2() && screenBounds.Y2() >= s.Bounds.Y)
                        {
                            range.AddRange(s.Bounds.Y, s.Bounds.Width);
                        }
                    }
                    if (range.Count > 0)
                    {
                        // 移動先がある
                        x            = toX + confMargin;
                        y            = range.Convert(y, screenBounds.Y, screenBounds.Height);
                        screenBounds = Screen.FromPoint(new Point(x, y)).Bounds;
                        this.BeginInvoke((Action)(() => label1.Text = string.Format("{0}", screenBounds)));
                        return;
                    }
                    break;

                case Direction.Up:
                    break;

                case Direction.Down:
                    break;
                }
            }

            // 移動先が無い
            // todo: MultiDisplay
            if (warp)
            {
                switch (direction)
                {
                case Direction.LeftUp:
                    // 右下へ移動
                    x = screenBounds.X2() - confMargin;
                    y = screenBounds.Y2() - confMargin;
                    break;

                case Direction.RightUp:
                    // 左下へ移動
                    x = screenBounds.X + confMargin;
                    y = screenBounds.Y2() - confMargin;
                    break;

                case Direction.LeftDown:
                    // 右上へ移動
                    x = screenBounds.X2() - confMargin;
                    y = screenBounds.Y + confMargin;
                    break;

                case Direction.RightDown:
                    // 左上へ移動
                    x = screenBounds.X + confMargin;
                    y = screenBounds.Y + confMargin;
                    break;

                case Direction.Left:
                    // 右へ移動
                    x = screenBounds.X2() - confMargin;
                    break;

                case Direction.Right:
                    // 左へ移動
                    x = screenBounds.X + confMargin;
                    break;

                case Direction.Up:
                    // 下へ移動
                    y = screenBounds.Y2() - confMargin;
                    break;

                case Direction.Down:
                    // 上へ移動
                    y = screenBounds.Y + confMargin;
                    break;
                }
            }
        }