[C#]螢幕擷取畫面

        void CaptureScreen(String index)
        {
            //Bitmap myImage = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
            Bitmap myImage = new Bitmap(1920, 1080);
            Graphics g = Graphics.FromImage(myImage);
            g.CopyFromScreen(new Point(1920, 100), new Point(0, 0), new Size(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height));
            IntPtr dc1 = g.GetHdc();
            g.ReleaseHdc(dc1);
            myImage.Save("Cap\\screen_" + index + ".jpg");

        }

發佈留言