我在保存Image控件的图片时,老是出错,代码如下,请大家看看,谢谢
- C# code
string message = "保存成功"; try { BitmapSource source = ImagePanel.Source as BitmapSource; if (source == null) return; WriteableBitmap wb = new WriteableBitmap(source); using (MemoryStream stream = new MemoryStream(50000)) { wb.SaveJpeg(stream, wb.PixelWidth, wb.PixelHeight, 0, 100); stream.Seek(0, SeekOrigin.Begin); Guid guid = Guid.NewGuid(); try { PhoneUtils.SavePicture(stream, guid.ToString() + ".jpg"); } catch (Exception ex) { message = "保存失败,错误:" + ex.Message; } } } catch (Exception ex) { message = ex.Message; }
------解决方案--------------------
没搞过这方面,关注一下