且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

用c#捕获Windows窗体的屏幕截图

更新时间:2023-12-06 12:20:04

尝试一下

 Rectangle bounds = Screen.GetBounds(Point.Empty);
 using (Bitmap bitmap = new Bitmap(bounds.Width, bounds.Height))
 {
    using (Graphics g = Graphics.FromImage(bitmap))
    {
       g.CopyFromScreen(Point.Empty, Point.Empty, bounds.Size);
    }
    bitmap.Save("c://My_Img.jpg", ImageFormat.Jpeg);
 }