结果是GDI
Graphics
类有
CopyFromScreen
方法可以很好地工作并捕获
Frame
内容:
var topLeftCorner = PreviewFrame.PointToScreen(new System.Windows.Point(0, 0));
var topLeftGdiPoint = new System.Drawing.Point((int)topLeftCorner.X, (int)topLeftCorner.Y);
var size = new System.Drawing.Size((int)PreviewFrame.ActualWidth, (int)PreviewFrame.ActualHeight);
var screenShot = new Bitmap((int)PreviewFrame.ActualWidth, (int)PreviewFrame.ActualHeight);
using (var graphics = Graphics.FromImage(screenShot)) {
graphics.CopyFromScreen(topLeftGdiPoint, new System.Drawing.Point(),
size, CopyPixelOperation.SourceCopy);
}
screenShot.Save(@"C:\screenshot.png", ImageFormat.Png);