Does WPF support reading/writing WMF/EMF files natively?

前端 未结 2 353
庸人自扰
庸人自扰 2021-01-02 05:06

Can Windows Presentation Foundation read/write WMF/EMF files without having to use WinForms Interop or Win32.

If it does not, what is the reason?

2条回答
  •  有刺的猬
    2021-01-02 05:27

    I did it !!!

    I'm using ComponentOne's WPF chart in my real code but to keep the example simple I just did a button. But it DOES work on Complex wpf widgets. Fonts, Transparency, AntiAlias etc. everything works. And I can paste into Word and change labels on charts etc.

    Basically I decimate the XAML to XPS then import it back into XAML.

    Then I used an open source project that converts XAML to WMF called XAMLToys.

    XAMLToys would fail 99% of the time because you cannot serial complex XAML objects

    http://softronix.com/download/WpfToWmfClipboard.zip

    Big kudos to these two projects

    http://xamltoys.codeplex.com/

    http://khason.net/blog/converting-fixeddocument-xpsdocument-too-to-flowdocument/

提交回复
热议问题