private void btn_zellen_zufall_Click(object sender, EventArgs e) { if (Matchfield.CurrentMatchfield.Controls.Count <= 0) { Label_matchfield_zero.Visible = true; return; } Label_loading_done.Visible = false; Matchfield.Btn_reset_Click(null, null); var cells = Matchfield.CurrentMatchfield.Controls.Cast <Button>().ToArray(); var amount = new Random().Next(3, cells.Length / 3 + 1); for (var i = 0; i < amount; i++) { var ran = new Random().Next(cells.Length); cells[ran].BackColor = Color.Red; Thread.Sleep(1); } Label_random_load.Visible = false; Label_loading_done.Visible = true; }
private void btn_eingaben_uebernehmen_Click(object sender, EventArgs e) { y_previousText = Y_Input.Text; x_previousText = X_Input.Text; btn_eingaben_uebernehmen.Enabled = false; Matchfield = new Matchfield(x_number, y_number); btn_start_game.Enabled = true; btn_spielfeld_aufrufen.Enabled = true; btn_zellen_zufall.Enabled = true; Label_size_load.Visible = false; Label_input_confirmed.Visible = true; Label_matchfield_zero.Visible = false; }