public GameWindow() { InitializeComponent(); tableLayoutPanel1.ColumnCount = columnas; for (int i = 8; i < columnas; i++) { tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 12.5F)); } tableLayoutPanel1.RowCount = filas; for (int i = 8; i < filas; i++) { tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType.Percent, 12.5F)); } panel1.Visible = false; label3.Visible = false; reloj.Start(); timer1.Enabled = true; botones = new Button[filas, columnas]; for (int i = 0; i < filas; i++) { for (int j = 0; j < columnas; j++) { Button button = new Button(); tableLayoutPanel1.Controls.Add(button, i, j); button.Anchor = AnchorStyles.Left; button.BackColor = Color.Transparent; button.Dock = DockStyle.Fill; OpenAnimation.SetDecoration(button, BunifuAnimatorNS.DecorationType.None); CloseAnimation.SetDecoration(button, BunifuAnimatorNS.DecorationType.None); button.Font = new Font("Microsoft Sans Serif", fontsize, FontStyle.Bold, GraphicsUnit.Point, ((byte)(0))); button.Location = new Point(3, 3); button.Name = "button" + Convert.ToString(i) + Convert.ToString(j); button.Size = new Size(64, 64); button.TabIndex = 1; button.Text = "button" + Convert.ToString(i) + Convert.ToString(j); button.UseVisualStyleBackColor = true; button.Click += new EventHandler(Button_Click); button.MouseUp += new MouseEventHandler(Button_MouseUp); botones[i, j] = button; } } foreach (Control control in Controls) { if (control is Button) { control.Click += Button_Click; } } try { string archivo = File.ReadAllText("Records.txt"); var lineas = archivo.Split('\n'); for (int i = 0; i < 10; i++) { if (i < lineas.Length) { records.Add(lineas[i]); recordsText[i] = records[i]; } else { records.Add(""); } } } catch (Exception) { for (int i = 0; i < 10; i++) { records.Add(""); recordsText[i] = ""; } } label1.Text = ""; label3.Text = " Top 10 records:\n\n1) " + recordsText[0] + "\n\n2) " + recordsText[1] + "\n\n3) " + recordsText[2] + "\n\n4) " + recordsText[3] + "\n\n5) " + recordsText[4] + "\n\n6) " + recordsText[5] + "\n\n7) " + recordsText[6] + "\n\n8) " + recordsText[7] + "\n\n9) " + recordsText[8] + "\n\n10) " + recordsText[9]; matriz = new int[filas, columnas]; for (int i = 0; i < filas; i++) { for (int j = 0; j < columnas; j++) { botones[i, j].Text = ""; matriz[i, j] = 0; } } Random random = new Random(); int a; int b; for (int i = 0; i < BombmonsNumber; i++) { a = random.Next(0, filas); b = random.Next(0, columnas); while (matriz[a, b] == 1) { a = random.Next(0, filas); b = random.Next(0, columnas); } matriz[a, b] = 1; } }