void puzzle_GiveFeedback(object sender, GiveFeedbackEventArgs e)
        {
            Puzzle puzzle        = (Puzzle)sender;
            Point  relativePoint = _form.PointToClient(Cursor.Position);

            puzzle.Location            = new Point(Cursor.Position.X - differnceBetweenCursorAndPuzzleX, Cursor.Position.Y - differnceBetweenCursorAndPuzzleY);
            puzzle.topPuzzle.AllowDrop = true;
            smallPuzzles.SetTopPuzzleLocation(puzzle);
            smallPuzzles.SetBottomPuzzleLocation(puzzle);
            smallPuzzles.SetRightPuzzleLocation(puzzle);
            smallPuzzles.SetLeftPuzzleLocation(puzzle);
            puzzle.Refresh();
        }
 private void SetSmallPuzzles(Puzzle puzzle)
 {
     if (puzzle.topPuzzle != null)
     {
         smallPuzzles.SetTopPuzzleLocation(puzzle);
     }
     if (puzzle.rightPuzzle != null)
     {
         smallPuzzles.SetRightPuzzleLocation(puzzle);
     }
     if (puzzle.bottomPuzzle != null)
     {
         smallPuzzles.SetBottomPuzzleLocation(puzzle);
     }
     if (puzzle.leftPuzzle != null)
     {
         smallPuzzles.SetLeftPuzzleLocation(puzzle);
     }
 }
Beispiel #3
0
        private void SetLeftPuzzle(Puzzle puzzle)
        {
            List <Puzzle> intersectedPuzzles = _puzzles.Select(x => x.rightPuzzle)
                                               .Where(x => x.Bounds.IntersectsWith(puzzle.Bounds) && x != puzzle && x.Location.X != 0 && x.Location.Y != 0)
                                               .ToList();

            puzzle.leftPuzzle = new List <Puzzle>();
            if (intersectedPuzzles.Count != 0)
            {
                for (int i = 0; i < intersectedPuzzles.Count; i++)
                {
                    Puzzle leftPuzzle = new Puzzle();
                    leftPuzzle.Size        = new Size(10, 10);
                    leftPuzzle.CoordinateX = intersectedPuzzles[i].Location.X;
                    leftPuzzle.CoordinateY = intersectedPuzzles[i].Location.Y - puzzle.Location.Y;
                    setSmallPuzzle.SetLeftPuzzleLocation(puzzle);
                    _form.Controls.Add(leftPuzzle);
                    puzzle.leftPuzzle.Add(leftPuzzle);
                }
            }
        }