- - * - WhiteUnicorn - * - -




* #WhiteUnicorn/ StartPage/ Documentation/DelphiFAQ >


Frequently Asked Questions

How can I place a bitmap in a Metafile?

Question:

How can I place a bitmap in a Metafile?

Answer:

The following example demonstrates drawing a bitmap into a

metafile.



Example:



procedure TForm1.Button1Click(Sender: TObject);

 var

   m : TmetaFile;

   mc : TmetaFileCanvas;

   b : tbitmap;

begin

  m := TMetaFile.Create;

  b := TBitmap.create;

  b.LoadFromFile('C:\SomePath\SomeBitmap.BMP');

  m.Height := b.Height;

  m.Width := b.Width;

  mc := TMetafileCanvas.Create(m, 0);

  mc.Draw(0, 0, b);

  mc.Free;

  b.Free;

  m.SaveToFile('C:\SomePath\Test.emf');

  m.Free;

  Image1.Picture.LoadFromFile('C:\SomePath\Test.emf');

end;




* #WhiteUnicorn/ StartPage/ Documentation/DelphiFAQ >



- - * - Anastasija aka WhiteUnicorn - * - - LJLiveJournal
PFPhotoFile