Sunday, 13 July 2014

How to capture a screen shot of screen?


To capture screen shot write a funtion:

 Bitmap  getScreen( )
        {
            Size s = Screen.PrimaryScreen.Bounds.Size;   //gives the screen size
            Bitmap bt = new Bitmap(s.Width, s.Height);   //create object of Bitmap with screen size
            Graphics g = Graphics.FromImage(bt);
            g.CopyFromScreen(0, 0, 0, 0, s);
            return bt;
        }

now you can assign the captured screen to picture box as:
pictureBox1.Image=getScreen( );

No comments:

Post a Comment