How to place a bitmap in a Metafile?



How to place a bitmap in a Metafile?..

Answer / Ramjeet Singh Marchhal

To place a bitmap into a metafile (TMetafilePict) in Delphi, you can use the TBitmap.SaveToStream method and then load the stream into the metafile. Here's an example:nn```delphinprocedure SaveBitmapToMetafile(const Bitmap: TBitmap; const Metafile: TMetafilePict);nvarn Stream: TMemoryStream;nbeginn // Save the bitmap to a memory streamn Stream := TMemoryStream.Create();n Bitmap.SaveToStream(Stream);nn // Load the metafile and place the bitmap inside itn Metafile.LoadFromStream(Stream);n Metafile.BitBlt(0, 0, Bitmap.Width, Bitmap.Height, 0, 0, Bitmap.Width, Bitmap.Height, SRCCOPY or $20);nend;n```

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Delphi Interview Questions

How to Find the RepositoryId of a CORBA Server?

1 Answers  


what is Client launching ?

1 Answers  


How to Use the Shell API function SHBrowseForFolder() ?

1 Answers  


How to create an About Box in Delphi or C++ Builder?

1 Answers  


Can you drag and drop existing SQL structures directly onto a form?

1 Answers  


How to Set the caption of the preview window?

1 Answers  


How to convert a color to a shade of gray?

1 Answers  


What are the reasons involved in using the interface?

1 Answers  


How to Get the filename and path of a local table?

1 Answers  


How to set the default form font in Delphi?

1 Answers   Reliance,


How to create indexes with the TTable create function?

1 Answers  


How to create a Resource only DLL?

1 Answers  


Categories