Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Library for using SVG in Windows Forms / WPF?

Tags:

Are there any libraries which

  1. Allow to draw svg direct to a Windows Forms application
  2. to a WPF application

I draw graphics and design everything with Inkscape, because I love that program. Then I have those stunning svgs and have to either export them to png (WinForm) to use them or convert them to xaml-code (WPF) (Kaxaml helps me).

Is there a way to directly use my svgs?

like image 904
Xn0vv3r Avatar asked Jan 22 '09 06:01

Xn0vv3r


People also ask

Can you use SVG in WPF?

Sorry to resurrect this post, but I think this information has value: an SVG is essentially a one-to-one match with a WPF Path. So other than some superficial markup adjustments, you should be able to just bring the SVG right into your WPF application.

Does WinForms support SVG?

I have tried SVG.NET with WinForms and it works excellent. Show activity on this post. If you are using the webbrowser control for SVG, you will have a problem with Access Violation due to Data Execution Prevention. For additional information see this link.

Can you mix WinForms and WPF?

Yes you can, both Windows Forms within a WPF application, and WPF controls within Windows Forms.

Is WPF harder than WinForms?

It is simple to use WinForms as controls can be used easily, it's less time-consuming and less tricky as compared to WPF.


2 Answers

Wow, I just read that Inkscape supports saving as XAML. I didn't realize that up to now shame.

But that still doesn't solve my problems with WinForms...

like image 176
Xn0vv3r Avatar answered Oct 16 '22 14:10

Xn0vv3r


I personally hate how there's no native support for SVG in Microsoft's products/development tools. I've found two fairly complete but still immature SVG libraries that seem to be active as of this writing, definitely in need of contributors though.

  • WPF : Svg2Xaml (open source)
  • WinForms : SVG rendering engine (open source)

IIRC both libraries output a Drawing object which can be used directly through the Image class; You'll figure it out, they're both pretty straightforward to use.

like image 29
hannson Avatar answered Oct 16 '22 14:10

hannson