Solved

How to create a metafile in Delphi 3 ?

Posted on 1997-11-25
3
736 Views
Last Modified: 2012-06-27
How to draw some boxes and lines to a tmetafile object and save as a windows enhances metafile format?
0
Comment
Question by:jlislo
  • 2
3 Comments
 
LVL 4

Accepted Solution

by:
StevenB earned 100 total points
Comment Utility
Hi Jlislo,

  The procedure is to create the metafile, then create a metafilecanvas. when you free the metafilecanvas, whatever you've drawn on it becomes the contents of the metafile. Saving the file is as simple as calling SaveToFile.

  Example:

procedure TForm1.Button1Click(Sender: TObject);
var
  AMetafile : TMetafile;
  AMetafileCanvas : TMetafileCanvas;
begin
  AMetaFile := TMetafile.Create;

  AMetafileCanvas := TMetafileCanvas.Create(AMetaFile, 0);
  try
    AMetaFileCanvas.LineTo(100,100);
    // Draw the imagea on the MetafileCanvas Here
  finally
    AMetafileCanvas.Free;
  end;

  AMetafile.SaveToFile('FileName');
  AMetaFile.Free;
end;

  Steven.
0
 

Author Comment

by:jlislo
Comment Utility
What is the different between enhance metafile and a normal metafile in program wise?
0
 
LVL 4

Expert Comment

by:StevenB
Comment Utility
 The difference between the standard and enhanced metafiles behaviour is pretty small. TMetafile has an Enhanced property which you can set to true to force EMF format. Enhanced metafiles are the new standard and should be used for most purposes, nornal metafiles are provided for back compatibility only. Delphi actually converts normal metafiles (WMF) into enhanced metafiles (EMF) for its own purposes anyway.

  Steven.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
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 (http://www.enterprise.efax.com), 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…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

744 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

17 Experts available now in Live!

Get 1:1 Help Now