コード例 #1
0
        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();
        }
コード例 #2
0
        public void Construct(List <Puzzle> puzzles)
        {
            puzzles.Sort();
            foreach (Puzzle puzzle in puzzles)
            {
                Puzzle automatedPuzzle = new Puzzle();
                automatedPuzzle.Location    = new System.Drawing.Point(puzzle.CoordinateX + form.Width - _image.Width - distanseBetweenControls, puzzle.CoordinateY + distanseBetweenControls);
                automatedPuzzle.Size        = new System.Drawing.Size(puzzle.Width, puzzle.Height);
                automatedPuzzle.Width       = puzzle.Width;
                automatedPuzzle.Height      = puzzle.Height;
                automatedPuzzle.Image       = puzzle.Image;
                automatedPuzzle.BorderStyle = BorderStyle.Fixed3D;
                automatedPuzzle.Click      += new EventHandler(automatedPuzzle_Click);

                if (puzzle.topPuzzle != null && puzzle.topPuzzle.Image != null)
                {
                    automatedPuzzle.topPuzzle       = SetPuzzle(automatedPuzzle.topPuzzle);
                    automatedPuzzle.topPuzzle.Image = puzzle.topPuzzle.Image;
                    smallPuzzles.SetTopPuzzleLocation(automatedPuzzle);
                }
                if (puzzle.rightPuzzle != null && puzzle.rightPuzzle.Image != null)
                {
                    automatedPuzzle.rightPuzzle       = SetPuzzle(automatedPuzzle.rightPuzzle);
                    automatedPuzzle.rightPuzzle.Image = puzzle.rightPuzzle.Image;
                    smallPuzzles.SetRightPuzzleLocation(automatedPuzzle);
                }
                form.Controls.Add(automatedPuzzle);
                automatedConstructPuzzlesList.Add(automatedPuzzle);
                _image.SendToBack();
            }
        }
コード例 #3
0
 private void SetTopPuzzle(Puzzle puzzle)
 {
     puzzle.topPuzzle = new Puzzle();
     if (puzzle.CoordinateY != 0)
     {
         puzzle.topPuzzle.Size = new Size(10, 10);
         setSmallPuzzle.SetTopPuzzleLocation(puzzle);
         puzzle.topPuzzle.Image = GetPartOfImage(new Rectangle(puzzle.CoordinateX + puzzle.Width / 2, puzzle.CoordinateY - 10, 10, 10));
         _form.Controls.Add(puzzle.topPuzzle);
     }
 }
コード例 #4
0
 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);
     }
 }