473,385 Members | 1,535 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Copy MetaFile from the clipboard???

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?
Jan 27 '08 #1
1 3589
On Sun, 27 Jan 2008 16:07:10 -0800, bern11 <be****@yahoo.comwrote:
I can't get any variants of this to work:
Image tmp = Image.FromStream((System.IO.MemoryStream)
copyObject.GetData("MetaFilePict"));
I was afraid that might be the case. It definitely was for me a year ago
when I tried. :(
I'll check the PInvoke route....
Good luck. I think there should be enough information in that thread to
answer the question, but if not I know I've got some working code around
here somewhere that I can post, if need be.

Pete

Jan 28 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: TC | last post by:
Hello, Here is what I'm trying to do: -- Make sure both MS Excel and MS Word are running -- Create an Excel chart -- Save the Excel file -- Copy the Excel chart onto the clipboard using Ctrl...
5
by: TC | last post by:
Hello, Here is what I'm trying to do: -- Make sure both MS Excel and MS Word are running -- Create an Excel chart -- Save the Excel file -- Copy the Excel chart onto the clipboard using Ctrl...
1
by: andrew | last post by:
I have a MSchart object (COM Component) which I wish to insert as an image into a picture box so that I can print it out. 'I call the chart controls's EditCopy to pass data to the clipboard. ...
1
by: B. Cline | last post by:
Hi, I need to write a conversion routine to split pictures out of about 10000 word documents. (Actually the text is converted to RTF, the pictures should be converted to jpg). I thought I...
2
by: George Yefchak | last post by:
Hi I need to retrieve a metafile image from the clipboard and render it as a bitmap in my application. In particular, an image will be placed on the clipboard by pasting from PowerPoint (I...
7
by: lgbjr | last post by:
Hello All, I¡¯m using a context menu associated with some pictureboxes to provide copy/paste functionality. Copying the image to the clipboard was easy. But pasting an image from the clipboard...
17
by: Steve | last post by:
I'm trying to code cut, copy, and paste in vb 2005 so that when the user clicks on a toolbar button, the cut/copy/paste will work with whatever textbox the cursor is current located in (I have...
3
by: atif283 | last post by:
Hi I m worki on clip board m trying to copy RTF data(Text+Image) both txt and image on clip board its only pasting text On Excel not the image can any one help me in this regard I m using your...
2
by: Alexander Gorbylev | last post by:
Hi! Let the size of vector is e.g. 3.5". I render the same vector on a printer & a screen on the same procedure: printDoc_BeginPrint(object sender, PrintEventArgs e) { .... vector.Width *...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.