I need to use threading to pause/resume projectile motion. On the button3_Click
event the projectile motion is drawn on-screen:
public void button3_Click(object sender, EventArgs e)
{
//... Lots of drawingcode...
}
I need to pause/resume the projectile motion using the same button3_Click
but I am new to threading and cannot figure out how.
I have tried:
public partial class Simulation : Form
{
Thread parallel1;
Thread parallel2;
public Simulation()
{
InitializeComponent();
parallel1 = new Thread(new ThreadStart(button3_Click));
}
}
But I get an error...
No overload for 'button3_Click' matches delegate 'System.Threading.ThreadStart'
I think that I need two threads so that as one is paused, the other is running to take a button3_Click
and resume the other thread. How can this be done?