private void Form1_Load(object sender, EventArgs e) { background = new PictureBox(); this.Focus(); background.Location = new System.Drawing.Point(0, 40); background.Size = new System.Drawing.Size(278, 278); background.Name = "bk"; background.TabIndex = 0; background.TabStop = false; background.BackgroundImage = global::_2048_Game.Properties.Resources.background; this.Controls.Add(background); scores.Text = "0"; UpDate.Start(); if (GameOwer.Visible) { Form1_Load(sender, e); } GameOwer.Visible = false; foreach (PictureBox i in picture_matrix) { this.Controls.Remove(i); } num_matrix = new int[4, 4]; picture_matrix = new List <PictureBox>(); SpawnNumbers(); SpawnNumbers(); }
private void start_Click_1(object sender, EventArgs e) { scores.Text = "0"; UpDate.Start(); if (GameOwer.Visible) { Form1_Load(sender, e); } GameOwer.Visible = false; foreach (PictureBox i in picture_matrix) { this.Controls.Remove(i); } num_matrix = new int[4, 4]; picture_matrix = new List <PictureBox>(); SpawnNumbers(); SpawnNumbers(); }