Example #1
0
        private void btnIniziaPartita_Click(object sender, EventArgs e)
        {
            this.Controls.Clear();
            this.BackColor = Color.Black;

            timer          = new System.Windows.Forms.Timer();
            timer.Interval = (1000);
            timer.Tick    += new EventHandler(timer_Tick);
            timer.Start();

            seconds             = 0;
            NumeroCelleLiberate = 0;
            numberOfMoves       = 0;

            CampoMinato = new CampoMinato(NumeroRighe, NumeroColonne, NumeroMine);
            CampoMinato.PosizionaTesto();
            ShowBoard(CampoMinato);

            btnTornaMenu           = new Button();
            btnTornaMenu.Location  = new Point(405, 10);
            btnTornaMenu.AutoSize  = true;
            btnTornaMenu.Width     = 238;
            btnTornaMenu.Text      = "Torna al menù";
            btnTornaMenu.BackColor = Color.White;
            btnTornaMenu.Font      = new Font(Font.FontFamily, 20);
            btnTornaMenu.Visible   = true;
            btnTornaMenu.Click    += new EventHandler(Form1_Load_Message_Box);

            Label lblNumeroMine = new Label();

            lblNumeroMine.Location  = new Point(36, 35);
            lblNumeroMine.AutoSize  = true;
            lblNumeroMine.Text      = "Numero mine: " + CampoMinato.numero_mine;
            lblNumeroMine.BackColor = Color.Transparent;
            lblNumeroMine.ForeColor = Color.White;
            lblNumeroMine.Font      = new Font(Font.FontFamily, 12);

            lblFlags           = new Label();
            lblFlags.Location  = new Point(36, 55);
            lblFlags.AutoSize  = true;
            lblFlags.Text      = "Bandiere: " + CampoMinato.flags;
            lblFlags.BackColor = Color.Transparent;
            lblFlags.ForeColor = Color.White;
            lblFlags.Font      = new Font(Font.FontFamily, 12);

            lblTime           = new Label();
            lblTime.Location  = new Point(36, 75);
            lblTime.AutoSize  = true;
            lblTime.Text      = "Tempo: " + 0;
            lblTime.BackColor = Color.Transparent;
            lblTime.ForeColor = Color.White;
            lblTime.Font      = new Font(Font.FontFamily, 12);

            this.Controls.Add(lblNumeroMine);
            this.Controls.Add(lblFlags);
            this.Controls.Add(btnTornaMenu);
            this.Controls.Add(lblTime);
        }
Example #2
0
 private void ShowBoard(CampoMinato campo_minato)
 {
     for (int j = 0; j < campo_minato.NumeroLista(); j++)
     {
         campo_minato.LeggiCella(j).Click   += new EventHandler(btnCella_Click);
         campo_minato.LeggiCella(j).MouseUp += btnCella_MouseUp;
         this.Controls.Add(campo_minato.LeggiCella(j));
     }
 }