Mega Code Archive

 
Categories / Delphi / API
 

Determining is a canvas is a metafile canvas

Question: How can I determine in code if a canvas is a Metafile Canvas? Answer: You can check the return value of the Windows API function GetDeviceCaps() to check if a given dc is used by a Metafile. Example: if (GetDeviceCaps(Canvas.Handle, TECHNOLOGY) and DT_METAFILE) = DT_METAFILE then IsMetafileDc := True;