SPECIAL OFFER        Order and save right now!
20% off with the 729824315 dicscount code for Ultimate Pack and any another product for Delphi from Greatis Programming!

⤷ Put bitmap to metafile

This example shows, how to work with metafiles. For example, how to put some bitmap to metafile. Use standard methods and properties of TMetaFile and TMeFileCanvas types.

procedure TForm1.Button1Click(Sender: TObject);
var
  MyBitmap: TBitmap;
  MF: TMetaFile;
  MFCanvas: TMetaFileCanvas;
begin
  MyBitmap:=TBitmap.Create;
  MyBitmap.LoadFromFile('TestBMP.bmp');
  MF:=TMetaFile.Create;
  MFCanvas:=TMetafileCanvas.Create(MF, 0);
  MFCanvas.Draw(0, 0, MyBitmap);
  MFCanvas.Free;
  MyBitmap.Free;
  MF.SaveToFile('TestEMF.emf');
  MF.Free;
  Image1.Picture.LoadFromFile('TestEMF.emf');
end;
More for developers
Databases for Amazon Associates
Amazon Categories
Amazon Nodes