冰楓論壇
標題:
[C#] 擷取螢幕畫面
[打印本頁]
作者:
whitefox
時間:
2023-6-1 14:59
標題:
[C#] 擷取螢幕畫面
將目前畫面擷取下來另存一張點陣圖(bitmap)
public void CaptureScreen()
{
System.Drawing.Size size = Screen.PrimaryScreen.Bounds.Size;
System.Drawing.Bitmap bitmap
= new System.Drawing.Bitmap(size.Width, size.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(bitmap);
g.CopyFromScreen(0, 0, 0, 0, size);
bitmap.Save("screen.png", System.Drawing.Imaging.ImageFormat.Png);
}
複製代碼
歡迎光臨 冰楓論壇 (https://bingfong.com/)
Powered by 冰楓