Board index » delphi » Form.Print doesn't work with Windows 95 (D3)

Form.Print doesn't work with Windows 95 (D3)

Hi,

I am trying to print a form using Form.Print (Delphi 3). It works under
Windows NT,
but it fails to work under Windows 95 (we are developing under NT, running
under
95). Has anyone seen this bug before?  I also tried to use the 'Printer'
object, but
here I found the same problem, works under NT, but fails under 95:      

    with Printer do begin
        BeginDoc;
        PrintRect.Left := 0;                            // PrintRect :
TRect;
        PrintRect.Right:= PageWidth;
        PrintRect.Top := 0;
        PrintRect.Bottom := Trunc((PageWidth/Bitmap.Width)*Bitmap.Height);
        Canvas.StretchDraw(PrintRect,  Bitmap);
        EndDoc;
    end;

Could anyone please help me out on this one?

Thanks,
           Andrej Dake.

 

Re:Form.Print doesn't work with Windows 95 (D3)


On 29 Oct 1998 14:13:20 GMT, "Andrej Dake" <nlm7p...@ibmmail.com>
wrote:

Quote
>I am trying to print a form using Form.Print (Delphi 3). It works under Windows NT,
>but it fails to work under Windows 95 (we are developing under NT, running under
>95).

Most likely, it's not a question of NT vs. Win95, but rather the fact
that the printer driver you're using in Win95 can't handle
device-dependent bitmaps. In general, you can't successfully copy a
device-dependent bitmap from one device to another (from the video
device to the printer device, in this case).

What you can do is use TForm.GetFormImage to get a device-dependent
bitmap of the form, and then use StretchDIBits to copy it to the
printer in device-independent format. There is an example that shows
how to do this in the MANUALS.TXT file in the \Delphi16 folder on the
Delphi CD. There is also a TI document at the Inprise web site that
contains additional information.

-Steve

Other Threads