private void btnScreen_Click(object sender, EventArgs e) { ScreenShot screenShot = ScreenGrabber.Win32ScreenShot(2.0); Debug.WriteLine($"Size: {screenShot.Width} x {screenShot.Height} Length: {screenShot.Bytes.Length}"); pbScreen.Image = CreateBitmapFromScreenShot(screenShot); }
/// <summary> /// Create Screen Shots /// </summary> static void ScreenProc() { Console.WriteLine("Screen Thread running..."); while (true) { if (stopwatch.IsRunning == false) { stopwatch.Start(); } ScreenShot screenShotData = ScreenGrabber.Win32ScreenShot(2.0); lock (locker) { buffer = screenShotData.Bytes; } width = screenShotData.Width; height = screenShotData.Height; PrintFps(); Thread.Sleep(sleepTime); } }