Recent

Author Topic: TMetafile Canvas && TMetafile  (Read 7979 times)

lfrodrigues

  • New Member
  • *
  • Posts: 25
TMetafile Canvas && TMetafile
« on: November 18, 2006, 03:20:20 pm »
Hello,

I've used Delphi 3-5 some years ago. Now at my current job I have to transform a windows only (Delphi 3) application into a multiplatform application.

I've ported almost everything (excluding the use of TMetafile and Metafile Canvas).

This was used  to create one image for each page for pintpreview and print (using TPrinter).

Does anyone know how I can convert this to Lazarus?

Best regards,

Luis

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
RE: TMetafile Canvas && TMetafile
« Reply #1 on: November 23, 2006, 05:19:33 pm »
Metafile is Windows specific. Can´t you use the printer canvas directly? Without TMetafile. What functions from metafile do you need and cannot use on a normal canvas?

lfrodrigues

  • New Member
  • *
  • Posts: 25
TMetafile Canvas && TMetafile
« Reply #2 on: November 23, 2006, 07:43:32 pm »
I would like to user tcanvas but it does not work, for example I have this:

var a:tcanvas;
begin
a := tcanvas.Create;
a.TextOut(0,0,'ols');
a.destroy;

it complains canvas does not allow drawing. I haven't worked in delphi for quite some some and don't remenber how to make this work (if it works).

I need to draw to a canvas so I can make a printpreview.

Maybe you can help me.

Best regards

theo

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1932
TMetafile Canvas && TMetafile
« Reply #3 on: November 23, 2006, 08:27:51 pm »
Try Printer.Canvas

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
TMetafile Canvas && TMetafile
« Reply #4 on: November 23, 2006, 10:51:19 pm »
Quote from: "lfrodrigues"
I need to draw to a canvas so I can make a printpreview.


To make a print preview simply drop any component with a canvas, like a paintbox or a panel and draw on that. (MyPaintBox.Canvas or MyPanel.Canvas).

When you actually go to print, use TPrinter.Canvas and do the same drawing procedures.

lfrodrigues

  • New Member
  • *
  • Posts: 25
TMetafile Canvas && TMetafile
« Reply #5 on: November 28, 2006, 02:36:51 am »
Thanks for the replys.

 

TinyPortal © 2005-2018