Copy Bitmap From Screen - CSharp System.Drawing

CSharp examples for System.Drawing:Image Operation

Description

Copy Bitmap From Screen

Demo Code


using System.Windows.Forms;
using System.Text;
using System.IO;/* w w  w  .ja  v a  2 s.c  o m*/
using System.Drawing.Imaging;
using System.Drawing;
using System;

public class Main{
        public static Bitmap CopyFromScreen()
        {
            Rectangle screen_bounds = Screen.PrimaryScreen.Bounds;
            Bitmap image = new Bitmap(screen_bounds.Width, screen_bounds.Height);
            Graphics graphics = Graphics.FromImage(image);
            graphics.CopyFromScreen(Point.Empty, Point.Empty, screen_bounds.Size);
            graphics.Dispose();
            return image;
        }
}

Related Tutorials