Problem with TMetafile: The size is not kept!

Posted on 2005-04-23
Last Modified: 2008-03-04
Dear EE!
I want to convert a Object (like Mathtype Equation, ChemSketch Object)  from Word to Bitmap.
So I do these work:
Copy Object to Clipboard (I do it manually). Then Use TMetafile to Redraw it (I do it by Delphi): TMetafile.Assign(Clipboard) and then:
TBitmap.Width:= TMetafile.Width; TBitmap.Height:= TMetaFile.Height;
But a problem: the size of the image(width x height) is changed (become smaller)
Can you suggest me some enhanced Component or show me how to fix this problem?
Thanks much!
Question by:coldboy
    LVL 11

    Accepted Solution

    Just a guess,

    this may be because Word is using a different base measurement for the metafiles.

    After your assign of the tmetafile from the clipboard, extract the MMWidth and MMHeight values

    the convert these values to pixels on screen

    i.e. if the mmwidth is 100 then
    you need to find out what is 100mm in your screen resolution


    this gives you logical pixels per inch across the screen

    divide  this by 25.4 to get pixels per mm and then multiply by MMwidth value this should give you the width you need to set the bitmap to

    for height use


    LVL 5

    Author Comment

    Thanks! But I see using Screen.Pixelperinch is more easy.
    LVL 11

    Expert Comment

    Thats fine, the only thing you have to watch out for is that delphi gets screen.pixelsperinch from a call to


    now thats fine because in 99.999% of screens a pixel is square. However if you where to use the same code say to write to a printer, then its not always the case and its best to get individual measurements for X & Y.

    But its fine for what your doing

    Good Luck


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
    Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now