Re: printing metafiles



Jamie wrote:
Mike Glazer wrote:
I have the following code in Delphi where I am trying to print a metafile:

Printer.BeginDoc;

Printer.Canvas.StretchDraw(Rect(1,1,Printer.PageWidth-1,
Printer.PageHeight-1),m);

Printer.EndDoc;

But Dephi7 objects with the message
[Error] (1036): Incompatible types: 'TGraphic' and 'TMetafile'

And m is declared as a Graphics.TMetafile? And Printer is the one from the Printers unit? That error shouldn't happen. TMetafile is a direct descendant of TGraphic.

Please provide more context.

Create a Tpicture Object first..

MyPictureObject.Assign(M);
then pass the MyPictureObject instead of the M.

Then it won't even compile. TPicture is not a TGraphic, but StretchDraw requires a TGraphic.

remember to free it at some point after printing for example.


--
Rob
.