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

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 2520
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: fowlertrainer | last post by:
Hi ! My problem is that: I have a program that copy pictures from Notes NSF file. The format is METAFILE or METAFILEPICT. I can save these pictures with this code: import win32api import...
0
by: Ata | last post by:
Hello, I am trying to copy the contents of the output of SQL Reporting Services to a PowerPoint slide. For this, I am using SQL Reporting Services to obtain an IMAGE stream, which I paste to the...
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...
2
by: zbcong | last post by:
hello in my program,i have following method,it copy a jpg file to clipboard,and works well: Private Sub CopyImage() Dim file As System.IO.Stream =...
0
by: Ben Leino | last post by:
Hi out there, I have a quite huge problem that I can't solve after huge "googeling and msdnning". Ich have a litte VB.NET class that opens a PowerPoint Presentation (COM) and wants to extract...
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...
23
by: wylbur37 | last post by:
I'm running an Apache server on my own computer (Windows XP Pro). I wrote a simple PHP script (called test3.php) that I'm running by putting the following URL in the address bar of the browser...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.