当前位置: 代码迷 >> Windows Mobile >> 保存Image控件source 至本地出错,该怎么解决
  详细解决方案

保存Image控件source 至本地出错,该怎么解决

热度:13   发布时间:2016-04-25 07:39:26.0
保存Image控件source 至本地出错
我在保存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;            }


------解决方案--------------------
没搞过这方面,关注一下
  相关解决方案