예제 #1
0
        private void CheckHighlighting(int index)
        {
            if (game.RowValid(game.GetRowByIndex(index)))
            {
                for (var i = 0; i < game.gridWidth; i++)
                {
                    Control current = sudokuPanel.Controls.Find("sudoku_" + i + "_" + game.GetRowByIndex(index), true)[0];

                    current.ForeColor = Color.Green;
                    // Work in progress
                    //current.Enabled = false;
                }

                hintOutput.Text = "row valid";
            }

            if (game.ColumnValid(game.GetColumnByIndex(index)))
            {
                for (var i = 0; i < game.gridHeight; i++)
                {
                    Control current = sudokuPanel.Controls.Find("sudoku_" + game.GetColumnByIndex(index) + "_" + i, true)[0];
                    current.ForeColor = Color.Green;
                    //current.Enabled = false;
                }

                hintOutput.Text = "column valid";
            }

            if (game.SquareValid(game.GetSquareFromIndex(index)))
            {
                int square = game.GetSquareFromIndex(index);

                for (var i = 0; i < game.numberOfSquares; i++)
                {
                    Control current = sudokuPanel.Controls.Find("sudoku_" + game.GetColumnByIndex(game.GetBySquare(square, i)) + "_" + game.GetRowByIndex(game.GetBySquare(square, i)), true)[0];
                    current.ForeColor = Color.Green;
                    //current.Enabled = false;
                }

                hintOutput.Text = "square valid";
            }
        }