private static void CamThread() { cam = new Capture(); while (connected) { if (timer.Enabled) bitmap = new System.Drawing.Bitmap(cam.Width, cam.Height, cam.Stride, System.Drawing.Imaging.PixelFormat.Format24bppRgb, cam.GetBitMap()); Thread.Sleep(1); } }