我正在尝试使用Use代码在Mono C#中获取屏幕截图,但是当我调用CopyFromScreen时却遇到了System.NotImplementedException 。我的代码可与.NET一起使用,所以有没有其他方法可以使用Mono获取屏幕截图?
Bitmap bitmap = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
Graphics graphics = Graphics.FromImage(bitmap as Image);
graphics.CopyFromScreen(0, 0, 0, 0, bitmap.Size);
System.IO.MemoryStream memoryStream = new System.IO.MemoryStream();
bitmap.Save(memoryStream, imageFormat);
bitmap.Save(@"\tmp\screenshot.png", ImageFormat.Png);
Run Code Online (Sandbox Code Playgroud)
我正在使用Mono JIT编译器版本2.4.2.3(Debian 2.4.2.3 + dfsg-2)
更新:Mono无法拍摄屏幕截图。伤心。瘸。