当前位置: 动力学知识库 > 问答 > 编程问答 >

c# - Saving Canvas Drawing

问题描述:

I've created an app that lets the user draw a picture onto a Canvas. I would like the user to also be able to save that drawing to his Media Library. I've looked up info on IsolatedStorage but that's not exactly what I want, or am I wrong?

Thanks.

网友答案:

You can render you canvas to a WriteableBitmap

var bitmap = new WriteableBitmap(400, 400);
bitmap.Render(canvas, null);
bitmap.Invalidate();

You can then encode this as a JPEG and save to isolated storage as described in this blog post.

网友答案:

Use the MediaLibrary SavePictureToCameraRoll method. See this article for a full exmaple: http://msdn.microsoft.com/en-us/library/ff769549(v=VS.92).aspx

分享给朋友:
您可能感兴趣的文章:
随机阅读: