Grant
thanks, I discovered that I can kluge it if I print the main form thus;

  FormMain.PrintScale := poPrintToFit;
  FormMain.print;

its not quite what I wanted but I cant afford to continue gold plating it, so it
will do. The device context stuff looks like a lot of work, but thanks for your
offer anyway.

reegards
Leo

Grant Black wrote:

> Its been a long time since I used to handle printing programmatically but
> under C++ I used to scale the device context to fit drawings
>
> See the delphi help for TCanvas.Handle - you set the handle of your
> pagecontrol handle to a device context.
> (also see - GetDeviceContext(var WindowHandle: HWnd): HDC; virtual);
>
> Once you have a HDC then you should be able to use Win32 API calls such as
> ScaleWindowExtEx to scale your new device.
>
> I wrote a component a few years ago that zoomed & panned around a map by
> playing with the device context - should still have it somewhere if you want
> it...
>
> > -----Original Message-----
> > From: Leo Ramakers [mailto:[EMAIL PROTECTED]]
> > Sent: Friday, 7 January 2000 10:17
> > To: Multiple recipients of list delphi
> > Subject: [DUG]: scaling a print
> >
> >
> > hi folks
> > I am trying to print the displayed content a pagecontrol, and
> > have succeeded in getting print using the following code;
> >   if PrintDialog1.Execute then
> >   begin
> >   ......
> > with Printer do
> >   begin
> >     BeginDoc;
> >     for I := Start to Stop do
> >       begin
> >       PageControl.Pages[I].PaintTo(Handle, 10, 10);
> >       if I <> Stop then
> >         NewPage;
> >       end;
> >     EndDoc;
> >     end;
> >
> >   end;
> >
> > The problem is, I cant see how to scale the print to fit the
> > page. I have the same problem if I try
> >
> >   Mainform.Print
> >
> > Can anyone offer solution or tips?
> >
> > best regards
> > Leo Ramakers
> >
> > --------------------------------------------------------------
> > -------------
> >     New Zealand Delphi Users group - Delphi List -
> > [EMAIL PROTECTED]
> >                   Website: http://www.delphi.org.nz
> >
> ---------------------------------------------------------------------------
>     New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
>                   Website: http://www.delphi.org.nz

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to