Advertisement
AmidamaruZXC

Untitled

Jun 16th, 2020
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.86 KB | None | 0 0
  1. using System.Drawing;
  2. using System.Threading;
  3. using System.Windows.Forms;
  4.  
  5. namespace TestApp
  6. {
  7.     class Program
  8.     {
  9.         static void Main(string[] args)
  10.         {
  11.             var i = 0;
  12.             while (true)
  13.             {
  14.                 TakeScreenShot(i);
  15.                 i++;
  16.                 Thread.Sleep(1000 * 30);
  17.             }
  18.         }
  19.  
  20.         private static void TakeScreenShot(int i)
  21.         {
  22.             using (var bmp = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height))
  23.             {
  24.                 using (Graphics g = Graphics.FromImage(bmp))
  25.                 {
  26.                     g.CopyFromScreen(0, 0, 0, 0, Screen.PrimaryScreen.Bounds.Size);
  27.                     bmp.Save($@"C:\Users\furio\OneDrive\podbel\podbel{i}.png");  // saves the image
  28.                 }
  29.             }
  30.         }
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement