How to use Metafiles

var
  Form1 : TForm1;
  S     : TFileStream;
  Meta  : TMetaFile;
procedure TForm1.Button1Click(Sender: TObject);
begin
// Constructor Create sets Enhanced to True by default
 Meta := TMetaFile.Create;
// Note: To add comments into metafile, such
// as "CreatedBy" and "Description", use
// CreateWithComment constructor instead of Create
 With TMetaFileCanvas.CreateWithComment(Meta, 0,
  'Alex Fedorov','MetaDemo Project') do
  try
   Brush.Color := clRed;
   Ellipse(10, 10, 100, 100);
  finally
   Free;
  end;
  Form1.Canvas.Draw(0,0, Meta);
{
 The Enhanced property determines how the metafile
 will be stored on disk. If Enhanced is True, the
 metafile is stored as an .EMF (Win32 Enhanced
 Metafile). If Enhanced is False, the metafile is
 stored as a .WMF (Windows 3.1 Metafile, with Aldus
 header).
}
// Save to "file". Note that code checks for filename
// extentention and if it is '.WMF' uses ordinal saving,
// and if it is '.EMF' - enhanced saving
  Meta.SaveToFile('C:\META.EMF');
// Save to "stream". File always saved as EMF-file.
// This takes less space (nearly 1/2).
  S := TFileStream.Create('C:\METAS.WMF', fmCreate);
  Meta.SaveToStream(S);
  S.Free;
  Meta.Free;
end;
procedure TForm1.Button2Click(Sender: TObject);
// Show metafile stored in file
begin
 Meta := TMetaFile.Create;
 S := TFileStream.Create('C:\METAS.WMF', fmOpenRead);
 Meta.LoadFromStream(S);
 Form1.Canvas.Draw(100,100, Meta);
 S.Free;
 Meta.Free;
end;