whitefox 發表於 2023-6-1 14:59:40

[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);
}
頁: [1]
查看完整版本: [C#] 擷取螢幕畫面