简体   繁体   中英

Windows Phone 7 - Capture Screen

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?

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM