Windows Phone 7 - Capture Screen

2020-06-16 02:25发布

问题:

I am trying to capture the screen whilst my windows mobile application is running. I have this so far but I keep getting an ArgumentException of The parameter is incorrect. What am I doing wrong?

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;

The above is within my MainPage constructor.

Update

I managed to make use the great tutorial suggested by Matt.

However, it doesn't seem to capture anything from the WebBrowser.

1) Does anyone know how the native email application renders HTML email - what component does it use?

2) What is used to create the native applications in the Windows Phone 7 series?

回答1:

Here's another solution just published by Jeff Wilcox

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

It captures screenshots at intervals you specify and then saves them to IsolatedStorage.



回答2:

Not sure on first inspection. The SaveJpeg params look okay, but not sure about the WritableBitmap..

Check here for a code example:

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