private void btnBasket_Click(object sender, EventArgs e) { Ball ball = new BasketBall(random.Next(600) / 100, random.Next(20) + 1, new Point(random.Next(500), random.Next(300))); this.panel1.Controls.Add(ball.getPictureBox()); AddBall(ball); }
public Form1() { InitializeComponent(); random = new Random(); Ball ball = new BasketBall(random.Next(600) / 100, random.Next(20) + 1, new Point(random.Next(500), random.Next(300))); this.panel1.Controls.Add(ball.getPictureBox()); balls.Add(ball); ball = new BaseBall(random.Next(600) / 100, random.Next(20) + 1, new Point(random.Next(500), random.Next(300))); this.panel1.Controls.Add(ball.getPictureBox()); balls.Add(ball); }