.NET        ez       2012-04-18
透過 Graphics 中的 CopyFromScreen 即可達到複製螢幕功能!
全螢幕擷取到檔案:
            Bitmap myImage = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
            Graphics g = Graphics.FromImage(myImage);
            g.CopyFromScreen(new Point(0,0), new Point(0, 0), new Size(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height));
            IntPtr dc1 = g.GetHdc();
            g.ReleaseHdc(dc1);
            myImage.Save(@"c:\screen.jpg",System.Drawing.Imaging.ImageFormat.Jpeg);視窗畫面擷取到檔案:
            Bitmap myImage = new Bitmap(this.Width, this.Height);
            Graphics g = Graphics.FromImage(myImage);
            g.CopyFromScreen(new Point(this.Location.X, this.Location.Y), new Point(0, 0), new Size(this.Width, this.Height));
            IntPtr dc1 = g.GetHdc();
            g.ReleaseHdc(dc1);
            myImage.Save(@"c:\screen.jpg",System.Drawing.Imaging.ImageFormat.Jpeg);本文章網址: 
https://www.ez2o.com/Blog/Post/csharp-Print-Screen-Shots-to-Image
https://www.ez2o.com/Blog/Post/138
https://www.ez2o.com/Blog/Post/csharp-Print-Screen-Shots-to-Image
https://www.ez2o.com/Blog/Post/138
