WP7:应用程序截图如何实现代码截图?查了一下,好像是在模拟器上。使用WriteableBitmap从应用程序代码中获取应用程序的屏幕截图非常简单。LaurentBugnion在这里写得很好:http://geekswithblogs.net/lbugnion/archive/2010/12/28/taking-a-screenshot-from-within-a-silverlight-wp7-application.aspx来自Silverlight#WP7截图在应用程序中。publicstaticvoidSaveToMediaLibrary(FrameworkElementelement,stringtitle){try{varbmp=newWriteableBitmap(element,null);varms=newMemoryStream();bmp.SaveJpeg(ms,(int)element.ActualWidth,(int)element.ActualHeight,0,100);ms.Seek(0,SeekOrigin.Begin);varlib=newMediaLibrary();varfilePath=string.Format(title+".jpg");lib.SavePicture(文件路径,ms);MessageBox.Show("保存在你的媒体库中!","完成",MessageBoxButton.OK);}catch{MessageBox.Show("出现错误,保存前请断开手机与电脑的连接。","无法保存",MessageBoxButton.OK);}}以下是如何从您的应用截取页面代码的屏幕截图并将其保存到手机的照片库中。请注意,这不会捕获SysTray或AppBar:WriteableBitmapw=newSystem.Windows.Media.Imaging.WriteableBitmap(this,null);//'this'是你的当前页面WriteableBitmapw2=newSystem.Windows.Media.Imaging.WriteableBitmap(480,800);//spaceforSysTrayfor(inti=0;i不用怕,如果要截图的话,需要在外面使用类似截图的工具,以上是C#学习教程:WP7:Take应用截图分享所有内容,如果对你有用,需要了解更多C#学习教程,希望大家多多关注---本文收集自网络,不代表立场。如涉及侵权,请点击右边联系管理员删除,如需转载请注明出处:
