Ejemplo n.º 1
0
        public Form1()
        {
            InitializeComponent();
            board = new SudokuBoard(offsetX, offsetY);
            check = new CheckSudoku();
            solve = new SudokuSolve(board, check);


            Button solveButton = new Button()
            {
                Size     = new Size(150, 50),
                Font     = new Font("Arial", 16, FontStyle.Regular),
                Text     = "Solve",
                Location = new Point(50 + offsetX, 500 + offsetY)
            };

            Button checkButton = new Button()
            {
                Size     = new Size(150, 50),
                Font     = new Font("Arial", 16, FontStyle.Regular),
                Text     = "Check",
                Location = new Point(250 + offsetX, 500 + offsetY)
            };

            solveResult = new Label()
            {
                Size      = new Size(150, 40),
                Font      = new Font("Arial", 16, FontStyle.Regular),
                TextAlign = ContentAlignment.MiddleCenter,
                Text      = "----------",
                Location  = new Point(50 + offsetX, 460 + offsetY)
            };

            checkResult = new Label()
            {
                Size      = new Size(150, 40),
                Font      = new Font("Arial", 16, FontStyle.Regular),
                TextAlign = ContentAlignment.MiddleCenter,
                Text      = "----------",
                Location  = new Point(250 + offsetX, 460 + offsetY)
            };

            solveButton.Click += SolvePuzzle;
            checkButton.Click += CheckPuzzle;

            Controls.Add(solveButton);
            Controls.Add(checkButton);
            Controls.Add(solveResult);
            Controls.Add(checkResult);
            Controls.Add(board);


            Paint     += DrawBoard;
            MouseDown += Deselect;
        }
Ejemplo n.º 2
0
 void worker_DoWork(object sender, DoWorkEventArgs e)
 {
     SudokuSolve.SolvePuzzle((int[, ])(e.Argument));
 }