Get View as Vector

Is there a way to copy the contents of a goview as a vector image (like an eps) to the clipboard. Right now I use GoView.GetBitmap() but I would like to be able to get better resolution.
thanks, Jake

Try the MetafileView, in Demo1.
For the clipboard, override GoView.CreateDataObject, call the base method, and call DataObject.SetData with the metafile data.
For drag-and-drop, override GoToolDragging.DoDragDrop and call GoView.DoDragDrop with the metafile data.

Thanks for the reply. I put in the code you suggested.
The metafile that got written out did not have vector information in it. So it didn’t print nicely, any ideas?

No idea, really. As you can see in the code, it’s drawing to a Graphics that comes from a Metafile.
Maybe your application can’t read EMF files? Or EMF files with EMF+ records in it (for GDI+)?

I looked around google groups for quite a while, and I’m starting to think that writing to gdi and keeping it as vectors is not possible. I think I might just up the dpi of the image.
thanks, Jake

did you finally got a solution for this problem?

No, I think it’s true that drawing in .NET uses GDI+, and GDI+ does not write vector information to an EMF file.
For vector drawing you could write SVG using GoSvg, but that might not be copyable-pastable in Microsoft applications, since Microsoft doesn’t support SVG input, as far as I know.

we got it working.
Your metafile example in Demo1 is ok, except the fact that the metafile constructor needs one extra parameter. If you add the file path of the file to be saved as the first parameter in constructor, it gets saved as an emf file, otherwise if you use the Save method it is saved as a png file . you can see that if you edit the saved file with a text editor.
thank you!

That’s interesting – I hadn’t thought of that, and the documentation gives no hint of that either.
Alas, I still can’t get it to work in-memory and to the clipboard, for an Edit - Paste Special of the Enhanced Metafile data.
Anyway, thanks very much for your suggestion!

The latest 2.5 beta has a C# version of MetafileView that now writes out EMF files containing vector graphics. 1