2

Well I have two pictureboxes. First one is for metafile image, second is for bitmap image. When the picture is in clipboard after buttom has been pressed I need to check out the format of the picture and put it in the appropriate picturebox. I did next but for some reason it doesnt work. Help me out please.

        if (iData.GetDataPresent(DataFormats.MetafilePict)== true )
            try
            {
                if (ClipboardFunctions.OpenClipboard(this.Handle))
                {
                    if (ClipboardFunctions.IsClipboardFormatAvailable(CF_ENHMETAFILE) != 0) //CF_ENHMETAFILE=14
                    {
                        IntPtr intptr = ClipboardFunctions.GetClipboardData(CF_ENHMETAFILE);
                        pictureBox2.SizeMode = PictureBoxSizeMode.Zoom;
                        pictureBox2.Image = new System.Drawing.Imaging.Metafile(intptr, true);

                    }
                }
            }
        finally { ClipboardFunctions.CloseClipboard();  }
        else if (iData.GetDataPresent(DataFormats.Bitmap) == true)
            pictureBox1.Image = Clipboard.GetImage();

0 Answers0