whitefox 發表於 2023-6-28 22:35:15

[C#] 擷取電腦螢幕畫面(主螢幕部分)

private static Bitmap bmpScreenshot;
private static Graphics gfxScreenshot;
bmpScreenshot = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
gfxScreenshot = Graphics.FromImage(bmpScreenshot);
gfxScreenshot.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y, 0, 0, Screen.PrimaryScreen.Bounds.Size, CopyPixelOperation.SourceCopy);
bmpScreenshot.Save(@"c:\ScreenShot.png", System.Drawing.Imaging.ImageFormat.Png);
頁: [1]
查看完整版本: [C#] 擷取電腦螢幕畫面(主螢幕部分)