using System;
using System.Drawing;
using System.Windows.Forms;

namespace _ex_12_9
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            int w = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width;

            int h = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height;

            Bitmap image1 = new Bitmap(w, h);

            Graphics graph1 = Graphics.FromImage(image1);

            graph1.CopyFromScreen(0, 0, 0, 0, image1.Size);

            pictureBox1.Image = image1;
        }
    }
}