Board index » delphi » HELP: Need an example of METAFILE usage.

HELP: Need an example of METAFILE usage.

Hello !

I try now to find an working Delphi code which use metafiles. If you
have some example of metafile (creating, drawing, printing etc.) - can
you please post it here or send directly to me ?

Thanks in advance.

Best regards,

Alex.

 

Re:HELP: Need an example of METAFILE usage.


Quote
Alex Levitas wrote:

> Hello !

> I try now to find an working Delphi code which use metafiles. If you
> have some example of metafile (creating, drawing, printing etc.) - can
> you please post it here or send directly to me ?

> Thanks in advance.

> Best regards,

> Alex.

Alex:

Place a Timage component on your form.  This component has a built-in
property which allows you to load a *.wmf file.  Let me know if you need
additional info?

Re:HELP: Need an example of METAFILE usage.


alexl...@actcom.co.il (Alex Levitas) seems to have typed:

Quote
>Hello !
>I try now to find an working Delphi code which use metafiles. If you
>have some example of metafile (creating, drawing, printing etc.) - can
>you please post it here or send directly to me ?

Here is a quick & dirty (untried) example:

MDC:=CreateMetafile(nil);  {var MDC: THandle;}

Ellipse(MDC, 0, 0, 100, 100);  {Draw 100 radius circle}
{More GDI calls with MDC as first parameter}

MyMet:=TMetaFile.Create; {var MyMet: TMetafile;}
MyMet.Handle:=CloseMetafile(MDC);

{Now we can display it in a TImage}
Image1.Picture.Metafile:=MyMet;

{Or we can print it}
Printer.BeginDoc;
Printer.Canvas.Draw(0, 0, MyMet);
Printer.EndDoc;

MyMet.Free;

Other Threads