I can get bitmaps from the clipboard, but how do I get Metafiles?
The specific instance I am testing is copying a piece of Word clip-art
into the clipboard and trying to read it in an application. It appears
as a metafile type but isn't recognized as an image.
Given:
DataObject copyObject;
copyObject = (DataObject)Clipboard.GetDataObject();
string[] types = copyObject.GetFormats();
and types contains "MetaFilePict", this fails:
Metafile tmp = (Metafile) copyObject.GetData("MetaFilePict");
with:
'Unable to cast object of type 'System.IO.MemoryStream' to type
'System.Drawing.Imaging.Metafile'.
Also, copyObject.ContainsImage() is false.
How do I get the metafile out?