void puzzle_DragDrop(object sender, System.Windows.Forms.DragEventArgs e) { Puzzle puzzle = (Puzzle)sender; var controls = _form.Controls.Cast <Control>(); Panel intersectedPanel = controls .Where(x => x.Bounds.IntersectsWith(puzzle.Bounds) && x != puzzle && x.GetType() == typeof(Panel)).Cast <Panel>().FirstOrDefault(); if (intersectedPanel != null) { if (title != null) { title.Visible = false; } } else { puzzle.Location = new Point(startCoordinateX, startCoordinateY); smallPuzzles.SetTopPuzzleLocation(puzzle); smallPuzzles.SetBottomPuzzleLocation(puzzle); smallPuzzles.SetLeftPuzzleLocation(puzzle); smallPuzzles.SetRightPuzzleLocation(puzzle); } pictureCorrectness = new CheckForPictureBuildCorrectness(_form, _basePuzzleList); bool correct = pictureCorrectness.Check(_mixedPuzzleList); if (correct) { pictureCorrectness.Winner(_mixedPuzzleList); } }
void puzzle_DragDrop(object sender, System.Windows.Forms.DragEventArgs e) { Puzzle puzzle = (Puzzle)sender; var controls = _form.Controls.Cast<Control>(); Panel intersectedPanel = controls .Where(x => x.Bounds.IntersectsWith(puzzle.Bounds) && x != puzzle && x.GetType() == typeof(Panel)).Cast<Panel>().FirstOrDefault(); if (intersectedPanel != null) { if (title != null) { title.Visible = false; } } else { puzzle.Location = new Point(startCoordinateX, startCoordinateY); smallPuzzles.SetTopPuzzleLocation(puzzle); smallPuzzles.SetBottomPuzzleLocation(puzzle); smallPuzzles.SetLeftPuzzleLocation(puzzle); smallPuzzles.SetRightPuzzleLocation(puzzle); } pictureCorrectness = new CheckForPictureBuildCorrectness(_form, _basePuzzleList); bool correct = pictureCorrectness.Check(_mixedPuzzleList); if (correct) { pictureCorrectness.Winner(_mixedPuzzleList); } }