예제 #1
0
        // private bool[,] data;

        private void canvas_MouseClick(object sender, MouseEventArgs e)
        {
            if (e.Button == System.Windows.Forms.MouseButtons.Right)
            {
                int r = Grid1.CalcCellPosition(e.Location.Y);
                int c = Grid1.CalcCellPosition(e.Location.X);
                PlaceFlag(r, c);
                CountRemainingBombs();
                //CheckIfWin();
                Grid1.UpdateGUI();
            }
            if (e.Button == System.Windows.Forms.MouseButtons.Left)
            {
                int r = Grid1.CalcCellPosition(e.Location.Y);
                int c = Grid1.CalcCellPosition(e.Location.X);
                //Grid1.MakeFalse(r, c);
                if (!Grid1.flag[r, c])
                {
                    OpenGrid(r, c);
                }
                CheckIfWin();
                Grid1.UpdateGUI();
                CountRemainingBombs();
            }
        }