+ Reply to Thread
Results 1 to 2 of 2

Thread: Taking a screenshot of the screen

  1. #1
    Junior Member
    Join Date
    Feb 2012
    Posts
    19

    Taking a screenshot of the screen

    I want to take a screenshot of the screen using c# , any idea how can i do that ?
    Last edited by philip; 11-02-2012 at 01:41 PM.

  2. #2
    Junior Member
    Join Date
    Jan 2012
    Posts
    28
    The Method :
    Code:
            private Image CaptureScreen()
            {
                Rectangle screenSize = Screen.PrimaryScreen.Bounds;
                Bitmap target = new Bitmap(screenSize.Width, screenSize.Height);
                using (Graphics g = Graphics.FromImage(target))
                {
                    g.CopyFromScreen(0, 0, 0, 0, new Size(screenSize.Width, screenSize.Height));
                }
                return target;
            }
    Example on How to call it :
    Code:
            private void button1_Click(object sender, EventArgs e)
            {
                Image image = CaptureScreen();
                Bitmap Bmap = new Bitmap(image);
                Bmap.Save("IMG.bmp");
            }
    Hope that tutorial was informative to you .

+ Reply to Thread

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts