开发者

Windows Phone 7 - Capture Screen

开发者 https://www.devze.com 2023-04-12 08:01 出处:网络
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?

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 rend开发者_JS百科ers 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

0

精彩评论

暂无评论...
验证码 换一张
取 消