Board index » delphi » Canvas to Canvas with CopyRect

Canvas to Canvas with CopyRect

Hi
I had a little idea: display a page before printing.
So I have written a little procedure like the one below.
I create a Bitmap where I copy from the Printer canvas
wuith CopyRect :

My code :
========

     pageImage := TBitmap.create;

     client           := Form2.PaintBox.ClientRect;  { paintbox area}

     pageImage.Width  := Client.Right;
     pageImage.Height := Client.Bottom;

     Source    := Rect(0, 0,
                                   Printer.Pagewidth,
                                   Printer.pageHeight
                                   );

     pageImage.Canvas.CopyMode := cmSrcCopy;
     pageImage.Canvas.CopyRect(Client, Printer.Canvas, Source );

The copyRect does NOTHING !

Thanks for all suggestions.

M. FONDACCI

 

Re:Canvas to Canvas with CopyRect


-----------------------------------------------------------------------
This solution is brought to you by Joe Hecht's TExcellent products,
solving Form.Print and bitmap printing problems. Joe Hecht's TExcellent
products can be found at: http://home1.gte.net/joehecht/index.htm
-----------------------------------------------------------------------

Hi Marcel,

You cannot copy from a printer canvas (DC). They are read only.
The concept is that most printers have no frame buffer, therefore
its mighty hard to get the pixels back after they have been printed
on the paper. It might be possible to use a razor blade with toner
based systems to s{*word*99}e them off the paper, but it would be very
difficult to keep them in order <g>... Scanning the paper would
probably be easier.

I will soon be releasing a Device Independent recordable canvas
that will help.

Joe

Quote
Marcel Fondacci <m.fonda...@4gl.fr> wrote in message

news:8dcm4o$i2i$1@front5.grolier.fr...
Quote
> Hi
> I had a little idea: display a page before printing.
> So I have written a little procedure like the one below.
> I create a Bitmap where I copy from the Printer canvas
> wuith CopyRect :

> My code :
> ========

>      pageImage := TBitmap.create;

>      client           := Form2.PaintBox.ClientRect;  { paintbox area}

>      pageImage.Width  := Client.Right;
>      pageImage.Height := Client.Bottom;

>      Source    := Rect(0, 0,
>                                    Printer.Pagewidth,
>                                    Printer.pageHeight
>                                    );

>      pageImage.Canvas.CopyMode := cmSrcCopy;
>      pageImage.Canvas.CopyRect(Client, Printer.Canvas, Source );

> The copyRect does NOTHING !

> Thanks for all suggestions.

> M. FONDACCI

Other Threads