Windows Phone 7 - 捕获屏幕

时间:2011-10-12 15:31:49

标签: c# windows-phone-7

我正试图在我的Windows移动应用程序运行时捕获屏幕。到目前为止我有这个,但我一直得到The parameter is incorrect的ArgumentException。我做错了什么?

WriteableBitmap wb = new WriteableBitmap((int)this.ActualWidth, (int)this.ActualHeight);

wb.Render(this, null);

wb.Invalidate();

MemoryStream ms = new MemoryStream();

int h = 212;

int w = 444;

wb.SaveJpeg(ms, w, h, 0, 100); // The parameter is incorrect

BitmapImage bitmapImage = new BitmapImage();

bitmapImage.SetSource(ms);

image1.Source = bitmapImage;

以上是在我的MainPage构造函数中。

更新

我设法使用了Matt建议的优秀教程。

但是,它似乎没有从WebBrowser中捕获任何内容。

1)有没有人知道本机电子邮件应用程序如何呈现HTML电子邮件 - 它使用了哪个组件?

2)用于在Windows Phone 7系列中创建本机应用程序的内容是什么?

2 个答案:

答案 0 :(得分:6)

这是Jeff Wilcox刚刚发布的另一种解决方案

http://www.jeff.wilcox.name/2011/10/screenshots-cs-how-to-capture-screenshots-of-your-app-on-your-device/

它会按照您指定的时间间隔捕获屏幕截图,然后将其保存到IsolatedStorage。

答案 1 :(得分:1)

第一次检查时不确定。 SaveJpeg参数看起来没问题,但不确定WritableBitmap ..

点击此处查看代码示例:

http://geekswithblogs.net/lbugnion/archive/2010/12/28/taking-a-screenshot-from-within-a-silverlight-wp7-application.aspx