开发者

Save Chart as an image on Hard Drive

I am looking for ways to save the output of a Chart control as an image on the hard drive. Is 开发者_JAVA技巧it possible in SL? as I am not sure so thought of putting a question here..

Thanks...


have a look here: Can I programmatically capture snapshot of a Silverlight User Control?

You can simply take a screenshot of your chart. If you want to put in on the HD with silverlight you need to open a SaveFileDialog. Then it is possible.

EDIT: If you want to save it in different formats use ImageTools. http://imagetools.codeplex.com/. If you use ImageTools you can get a stream like this:

var editBitmap = new WriteableBitmap(1024, 786);
            editBitmap = new WriteableBitmap((int)(this.RenderSize.Width), (int)(this.RenderSize.Height));
            editBitmap.Render(this, new MatrixTransform());
            editBitmap.Invalidate();

            var myImage = editBitmap.ToImage();
            Stream stream = myImage.ToStreamByExtension("png");

Hope this helps.

BR,

TJ

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜