Solved

How to create a metafile in Delphi 3 ?

Posted on 1997-11-25
3
749 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
ID: 1351805
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
ID: 1351806
What is the different between enhance metafile and a normal metafile in program wise?
0
 
LVL 4

Expert Comment

by:StevenB
ID: 1351807
 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
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…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

828 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