I made a image recorder in a loop below, but I don't understand how I can stop recording. Here's my code
void Capture()
{
while (true)
{
Bitmap bm= new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
Graphics g = Graphics.FromImage(bm);
g.CopyFromScreen(0, 0, 0, 0, bm.Size);
pictureBox1.Image = bm;
Thread.Sleep(300);
}
}
private void btnRecord_Click(object sender, EventArgs e)
{
Thread t = new Thread(Capture);
t.Start();
}
Please help me!