将可视对象的内容保存为WPF中的图像文件? [英] Save content of a visual Object as a image file in WPF?

查看:131
本文介绍了将可视对象的内容保存为WPF中的图像文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将WPF对象的内容保存为图像文件。在我的应用程序中,我有一个在Canvas对象上绘制的图表。这就是我需要保存的东西。包含所有子对象的Canvas。

I need to save the content of a WPF Object as an Image file. In my application I have a chart drawn on a Canvas object. This is what I need to save. The Canvas with all child objects.

推荐答案

您正在寻找的是 RenderTargetBitmap class。在我链接的MSDN页面上有一个使用它的例子,还有一个很好的例子,包括在这里保存到文件:

What you're looking for is the RenderTargetBitmap class. There's an example of its use on the MSDN page I linked, and there's another good example that includes saving to a file here:

Eric Sinc的RenderTargetBitmap

这篇关于将可视对象的内容保存为WPF中的图像文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆