[英]Capture screen of the application on a Windows 10 Universal App
我需要捕获应用程序的屏幕以将其保存在设备上。 Windows 10通用应用程序可以吗?
如果您的应用专门在电话上运行,则可以使用“电话合同”中的ScreenCapture类。 在其他设备系列上不可用。
在其他设备上,您可以通过将应用程序渲染到屏幕外的位图中来捕获应用程序自身的窗口内容(但不能捕获其他窗口内容)。 对于Xaml应用程序,请使用RenderTargetBitmap类呈现页面的根。
RenderTargetBitmap renderTargetBitmap = new RenderTargetBitmap();
await renderTargetBitmap.RenderAsync(pageRoot, width, height);
使用GetPixelsAsync提取图像,使用BitmapEncoder编码为位图(jpg,png等),然后保存或共享结果。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.