冰楓論壇
標題:
[C#] 擷取電腦螢幕畫面(主螢幕部分)
[打印本頁]
作者:
whitefox
時間:
2023-6-28 22:35
標題:
[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);
複製代碼
歡迎光臨 冰楓論壇 (https://bingfong.com/)
Powered by 冰楓