Solved

How to create a metafile in Delphi 3 ?

Posted on 1997-11-25
3
754 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

Industry Leaders: 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

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
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…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

726 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