private void tsAddBall_Click(object sender, EventArgs e) { Ball b = new Ball(new Point(PADDING + Scene.GetBalls() * (2 * Ball.RADIUS + 25), Height / 2), Color); Scene.AddBall(b); IsChanged = true; Invalidate(true); }
private void timer_Tick(object sender, EventArgs e) { if (GenerateBall % 10 == 0) { int y = rand.Next(2 * Ball.RADIUS, Height - (Ball.RADIUS * 2)); int x = -Ball.RADIUS; Ball b = new Ball(new Point(x, y)); Scene.AddBall(b); } GenerateBall++; Scene.Move(Width); Invalidate(true); }