473,396 Members | 1,666 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,396 software developers and data experts.

Metafile issue

Hi there,

I am obtaining a meta file from the clipboard via the following code
Dim CF_ENHMETAFILE As Integer = 14
Dim cMFeImage As Imaging.Metafile

Dim pIPrClipboard As IntPtr = OpenClipboard(Me.Handle)

If (IsClipboardFormatAvailable(CF_ENHMETAFILE)) Then
Dim pIPrData As IntPtr = GetClipboardData(CF_ENHMETAFILE)
cMFeImage = New Imaging.Metafile(pIPrData, False)
Call cMFeImage.Save("c:\pop.emf", Imaging.ImageFormat.emf)
End If

Call CloseClipboard()
If I display the image in a picture box and redraw it during resize it
looks great, definitely an EMF, but the saved image "pop.emf" is not an
EMF, more like a JPEG, it's been rasterised somewhere along the lines and
now looks awful.

Any ideas what's happening?

If you open a spreadsheet in excel and copy a chart to the clipboard you
can use that. Again, looks great in VB, but not when saved.

BTW, I have tried seeing the 2nd property of the MetaFile constructor to
True / False, same thing happens.

Many thanks in advance.

Nick.
Dec 19 '06 #1
2 1707
It's okay, this problem was resolved.

"NickP" <ni**@nick.comwrote in message
news:OE**************@TK2MSFTNGP03.phx.gbl...
Hi there,

I am obtaining a meta file from the clipboard via the following code
Dim CF_ENHMETAFILE As Integer = 14
Dim cMFeImage As Imaging.Metafile

Dim pIPrClipboard As IntPtr = OpenClipboard(Me.Handle)

If (IsClipboardFormatAvailable(CF_ENHMETAFILE)) Then
Dim pIPrData As IntPtr = GetClipboardData(CF_ENHMETAFILE)
cMFeImage = New Imaging.Metafile(pIPrData, False)
Call cMFeImage.Save("c:\pop.emf", Imaging.ImageFormat.emf)
End If

Call CloseClipboard()
If I display the image in a picture box and redraw it during resize it
looks great, definitely an EMF, but the saved image "pop.emf" is not an
EMF, more like a JPEG, it's been rasterised somewhere along the lines and
now looks awful.

Any ideas what's happening?

If you open a spreadsheet in excel and copy a chart to the clipboard
you can use that. Again, looks great in VB, but not when saved.

BTW, I have tried seeing the 2nd property of the MetaFile constructor
to True / False, same thing happens.

Many thanks in advance.

Nick.

Dec 21 '06 #2
"NickP" <ni**@nick.comwrote:
>If I display the image in a picture box and redraw it during resize it
looks great, definitely an EMF, but the saved image "pop.emf" is not an
EMF, more like a JPEG, it's been rasterised somewhere along the lines and
now looks awful.
It's okay, this problem was resolved.
Could you say how the problem was resolved, please? I'm curious.

--
Lucian
Dec 21 '06 #3

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

Similar topics

2
by: Julian Ziersch | last post by:
This code causes a severe memory leak - the critical part is the call to GetHenhmetafile(). System.Drawing.Imaging.Metafile lImage = new System.Drawing.Imaging.Metafile("C:\\meta0.emf"); IntPtr...
1
by: sendhil | last post by:
hi, Iam doing some graphics programming with C#. I have to create a Windows MetaFile from a base64 encoded string. How do i create the file. I want to Overlay this Windows MetaFile on a image...
3
by: Richard Skopal | last post by:
In .NET Windows forms I can create a metafile using this code: Graphics grph = aControl.CreateGraphics(); IntPtr ipHDC = grph.GetHdc(); Metafile mf = new Metafile(aImgFilePath, ipHDC,...
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...
0
by: weiruic | last post by:
I am trying to create a metafile (.emf) on the harddisk, write graphics from a graphics object to it, and then save it. I can do this successfully except I cannot set the horizontal and vertical...
5
by: Peter | last post by:
Does anyone have a c# or vb.net example of how to convert bitmap to Metafile - preferably without writing anything to a file ? Thank You Peter
2
by: Laurent Navarro | last post by:
Hello, I am using a library which returns a byte containing RAW data, ie all pixels' color values coded in a byte array without header. I would like to save those data into a JPEG file so I...
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 *...
1
by: bern11 | last post by:
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. ...
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:
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...
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...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.