using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace WindowsFormsApplication3 { public partial class Form1 : Form { public PictureBox[,] hairetu = new PictureBox[10, 20]; public Form1() { Timer timer = new Timer(); timer.Tick += new EventHandler(MyClock); timer.Interval = 1000; timer.Enabled = true; // timer.Start()べ搌じ InitializeComponent(); } public void MyClock(object sender, EventArgs e) { bool chinko = true; for (int a = 0; a < 10; a++) { for (int b = 0; b < 20; b++) { if (hairetu[a, b] != null && hairetu[a, b].unko == true) { chinko = false; } } } if (chinko) { Random rnd = new Random(); int ransuu = rnd.Next(0, 9); hairetu[ransuu, 0] = new PictureBox(); hairetu[ransuu, 0].Location = new Point(ransuu * 20, 20); hairetu[ransuu, 0].BackColor = Color.Red; hairetu[ransuu, 0].Size = new Size(20, 20); this.Controls.Add(hairetu[ransuu, 0]); } } } }