Home All Groups Group Topic Archive Search About
Author
19 Dec 2006 2:55 PM
NickP
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.

Author
21 Dec 2006 5:39 PM
NickP
It's okay, this problem was resolved.

Show quoteHide quote
"NickP" <n***@nick.com> wrote in message
news:OEmt623IHHA.3676@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.
>
Author
21 Dec 2006 7:06 PM
Lucian Wischik
"NickP" <n***@nick.com> wrote:
>> 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