| Refresh | Home EGTry.com


using System;
using System.Drawing;
using System.Drawing.Imaging;


namespace ConsoleApplication1
{
    class ScreenCapture
    {
        public static void capture()
        {
            int w = 500, h = 300;

            Bitmap bitmap = new Bitmap(w, h);
            Graphics g = Graphics.FromImage(bitmap);
            Point sourcePoint = new Point(100, 50);
            Point destionPoint = new Point(0, 0);
            Size size = new Size(w, h);

            g.CopyFromScreen(sourcePoint, destionPoint, size);
            bitmap.Save("c://tmp/test.png", ImageFormat.Png);

            Console.WriteLine("Done");
        }
    }
}