private void Form1_MouseDoubleClick(object sender, MouseEventArgs e) { var choice = Random.Next(2); if (choice == 0) // add a blue ball { BallDoc.AddBall(e.Location, Color.Blue); } else if (choice == 1) { BallDoc.AddBall(e.Location, Color.Green); } Invalidate(true); }
private void Form1_MouseClick(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) // start moving a red ball, if clicked { if (BallDoc.SelectBall(e.Location)) { timer1.Start(); } } else if (e.Button == MouseButtons.Right) // add a red ball { BallDoc.AddBall(e.Location, Color.Red); Invalidate(true); } }