Exemplo n.º 1
0
 private void Vérifier_Click(object sender, EventArgs e)
 {
     if ((Control)sender != this)
     {
         if (grille.CheckSudoku())
         {
             string            message = "Voulez-vous relancer une partie ?";
             string            caption = "Vous avez terminé !";
             MessageBoxButtons buttons = MessageBoxButtons.YesNo;
             DialogResult      result;
             result = MessageBox.Show(message, caption, buttons);
             if (result == DialogResult.No)
             {
                 this.Close();
             }
             else
             {
                 grille = GenerateurGrille.ViderGrilleUnique(50);
                 this.initialisationLabel(grille);
             }
         }
         else
         {
             var mess   = "Le sudoku n'est pas juste ! Corrigez-le";
             var capt   = "Dommage !";
             var mb     = MessageBoxButtons.OK;
             var result = MessageBox.Show(mess, capt, mb);
         }
     }
 }
Exemplo n.º 2
0
        public Sudoku()
        {
            InitializeComponent();
            Console.Write("Intialisation");
            grille   = GenerateurGrille.ViderGrilleUnique(50);
            tabLabel = new List <Label>();

            for (int i = 0; i < 81; i++)
            {
                Label l = new Label();
                l.Height    = 50;
                l.Width     = 100;
                l.TextAlign = ContentAlignment.MiddleCenter;
                l.Font      = new Font("Arial", 20);

                l.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
                l.Click      += new EventHandler(changeValueLabel);
                tabLabel.Add(l);
                this.Grid.Controls.Add(l, i % 9, i / 9);
            }
            initialisationLabel(grille);
            this.Invalidate();
        }