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

你说的曾经没有我的故事 提交于 2019-11-29 19:01:26

问题


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?


回答1:


A quick search on MSDN reveals a thread containing a post by Peggi Goodwin, a PM at Microsoft:

WPF does not support the EMF and WMF image formats. These formats are more susceptible to security vulnerabilities than other image formats, so we do not intend to support them.




回答2:


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/



来源:https://stackoverflow.com/questions/554492/does-wpf-support-reading-writing-wmf-emf-files-natively

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!