/// <summary>
        /// Loads a PCPictureBox type object
        /// </summary>
        /// <param name="row">The maze row that the PCPictureBox will be created at.</param>
        /// <param name="col">The maze column that the PCPictureBox will be created at.</param>
        /// <param name="tileType">The enum that specifies the image.</param>
        /// <returns>Null if the tileType is of type "none", or the loaded PCPictureBox otherwise.</returns>
        private PCPictureBox LoadPictureBox(int row, int col, PictureTypeEnum tileType)
        {
            if (tileType == PictureTypeEnum.None)
            {
                return(null);
            }

            PCPictureBox pictureBox = new PCPictureBox
            {
                Size          = new Size(SQUARE_SIDE_SIZE, SQUARE_SIDE_SIZE),
                BorderStyle   = BorderStyle.FixedSingle,
                SizeMode      = PictureBoxSizeMode.StretchImage,
                PictureRow    = row,
                PictureColumn = col
            };

            pictureBox.Click += new EventHandler(PictureBox_Click);

            pictureBox.SetImage(tileType);

            if (tileType == PictureTypeEnum.GreenBox || tileType == PictureTypeEnum.RedBox)
            {
                pictureBox.Cursor = Cursors.Hand;
            }

            return(pictureBox);
        }
Example #2
0
        private void PictureBox_Click(object sender, EventArgs e)
        {
            PCPictureBox pictureClicked = sender as PCPictureBox;

            pictureClicked.SetImage(chosenPictureType);
        }