Solved

How to create a metafile in Delphi 3 ?

Posted on 1997-11-25
3
753 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

730 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