In the days before .net 2.0, you have to make a directly call into "gdi32.dll" to get a full screen shot. Now, .net 2.0 has included this powerful function: (enjoy it )

        private void GetAScreenShot()

        {

            this.Opacity = 0;

            Screen ScreenDimension = Screen.PrimaryScreen;

            Bitmap BmpScreenShot = new Bitmap(ScreenDimension.Bounds.Width, ScreenDimension.Bounds.Height);

            Graphics DesktopGraphics = Graphics.FromImage(BmpScreenShot);

            DesktopGraphics.CopyFromScreen(

                0,  //sourceX

                0,  //sourceY

                0,  //destX

                0,  //destY

                new Size(ScreenDimension.Bounds.Width, ScreenDimension.Bounds.Height)

                );

            BmpScreenShot.Save("d:\\temp.bmp");

            DesktopGraphics.Dispose();

            BmpScreenShot.Dispose();

            this.Opacity = 100;

        }

相关文章: