Drag & Drop + DataFormats.EnhancedMetafile & MetafilePict
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 1 of 1

Thread: Drag & Drop + DataFormats.EnhancedMetafile & MetafilePict

  1. #1
    Join Date
    Jul 2008
    Posts
    1

    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);
    stream.Seek(0, SeekOrigin.Begin);
    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
    if (OpenClipboard(this.Handle))
    {
    if (IsClipboardFormatAvailable(CF_ENHMETAFILE))
    {
    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;
    }
    }
    CloseClipboard();
    }


    But what to do with drag and drop? How to obtain image?
    Last edited by SlavaN; July 7th, 2008 at 09:46 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center