views:

233

answers:

2

I am working with a library that renders part of its state as an SVG document.

I would like to render this in either a Winforms or a WPF environment. Is there currently a way to do this?

If not, I could modify the library to use a more general rendering strategy, and then add an XML adapter to restore the original functionality, but this is not my preferred strategy.


This question also could benefeit from an answer: http://stackoverflow.com/questions/397189/how-to-display-vector-graphics-svg-in-a-winforms-application

+1  A: 

Here are two links that might help you (never used either one, myself):

http://www.jbrowse.com/svgnet/

http://sourceforge.net/projects/svgdomcsharp/

MusiGenesis
My google skills work, so I had found these two before. In fact, I am currently implementing a facade interface that can hide either an SvgNet.SvgGraphics object or a System.Drawing.Graphics object. I can use this `IGraphicsFacade` to render, and it with render to ths Svg graphics, or a real Graphics object. It is a little bit complicated, though.
John Gietzen
@John: I'd try the other answer in the question you linked to. Browsers can render SVG files, so it should be quite easy to just put a WebBrowser control on a form and set its Url property to your SVG file.
MusiGenesis
And sorry about the Google links - you never know what people can or can't do. At least I didn't use www.lmgtfy.com.
MusiGenesis
No, I wasn't offended. Just saying I did my due diligence. Anyways, adding a web browser just to show an image feel horribly wrong. I like the `IGraphics` facade way better. It is just a lot of work. I'm about 50% done.
John Gietzen
+1  A: 

Have you looked at Ab2d set of Apis? ReaderSvg and ViewerSvg seems to do the job? But they aren´t free!

Simon Söderman
That's WPF, not Winforms.
John Gietzen