470,568 Members | 1,535 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,568 developers. It's quick & easy.

When I put a metafile on the clipboard and pasted it, I get resized picture

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 * g.DpiX
....
}

On the paper (300/600dpi) or a preview on the screen (100%) the vector size
is correct (=3.5")

But when I put a metafile on clipboard by ClipboardMetafileHelper and paste
it to other programms,
I get the resized picture (~3.3"). Why?

*****************************
to put I use:

ClipboardMetafileHelper.PutEnhMetafileOnClipboard( this.Handle, mf )
{
bool bResult = false;
IntPtr hEMF, hEMF2;

hEMF = mf.GetHenhmetafile();
if (!hEMF.Equals(new IntPtr(0)))
{
hEMF2 = CopyEnhMetaFile(hEMF, new IntPtr(0));
.......
IntPtr hRes = SetClipboardData(14 /*CF_ENHMETAFILE*/, hEMF2);
bResult = hRes.Equals(hEMF2);

CloseClipboard();

}
*****************************
Best regards,
Alexander

Dec 5 '07 #1
2 2324
On Wed, 05 Dec 2007 08:34:24 -0800, Alexander Gorbylev
<ag*****@hotmail.com.nospamwrote:
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 * g.DpiX
....
}

On the paper (300/600dpi) or a preview on the screen (100%) the vector
size is correct (=3.5")

But when I put a metafile on clipboard by ClipboardMetafileHelper and
paste it to other programms,
I get the resized picture (~3.3"). Why?
You didn't post anything useful with respect to the question. It's
practically guaranteed that the act of putting the metafile on the
clipboard is _not_ the reason the size is different than you expect.

There are two possibilities: you've created the metafile incorrectly, and
it's not actually the size you expect it to be; or the application into
which you've pasted it isn't respecting the metafile's dimensional
information, either ignoring it altogether or misinterpreting it.

I suppose a third possibility is that .NET has a bug in which it generates
incorrect metafiles based on your code creating the metafile, but that
seems unlikely. I've used metafiles in .NET myself and didn't note any
problem like that.

Assuming your test to paper and screen is accurate, I would consider the
other application the likely culprit. But it's impossible to say for
sure. I would say the next step in debugging the problem would be for you
to write your own test application into which you can paste metafiles and
render them on-screen and/or to a printed page. That will give you more
information as to what the metafile coming from the clipboard looks like
and why it might not display correctly. Of course, if it _does_ display
correctly, then there's nothing you can do: it's the other application's
fault for not dealing with the metafile correctly.

Pete
Dec 5 '07 #2
>It's practically guaranteed that the act of putting the metafile on the
>clipboard is not the reason the size is different than you expect.
Hm, I considered that..
>There are two possibilities: you've created the metafile incorrectly
Very strange...On print/preview I have predicted result.
>or the application...
Two applications (MS Word, Corel Draw) has the same reduced (~5%) sizes of
picture from clipboard :-/

Thank you, Pete!

Dec 6 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by fowlertrainer | last post: by
1 post views Thread by sendhil | last post: by
2 posts views Thread by zbcong | last post: by
2 posts views Thread by George Yefchak | last post: by
1 post views Thread by bern11 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.