July 7th, 2008, 08:38 AM
Get Drag & Drop MS Word image + DataFormats.EnhancedMetafile & MetafilePict
Hi, help please.
I am trying to Drag&Drop image from MS Word to Picture box.
e.Data.GetDataPresent(DataFormats.EnhancedMetafile) & e.Data.GetDataPresent(DataFormats.MetafilePict) shows that data is present, but when I try
Stream stream = (Stream)e.Data.GetData(DataFormats.MetafilePict);
Image img = new Metafile(stream);
or the same for the DataFormats.EnhancedMetafile it crushes and doesn't work.
there is same problem for the clipboard, but it is solved using PInvoke like
//Pasting into PictureBox
IntPtr ptr = GetClipboardData(CF_ENHMETAFILE);
if (!ptr.Equals(new IntPtr(0)))
Metafile metafile = new Metafile(ptr,true);
//Set the Image Property of PictureBox
this.pictureBox1.Image = metafile;
But what to do with drag and drop? How to obtain image?
Last edited by SlavaN; July 7th, 2008 at 08:46 AM.
Click Here to Expand Forum to Full Width
This is a Codeguru.com survey!