Board index » cppbuilder » Printing {*word*88}s on TCheckBox, TButton, etc.

Printing {*word*88}s on TCheckBox, TButton, etc.

Hello,

I'm writing my first BCPP app from which users need to be able to
print.  As a first step, I'm drawing from the example code in the help
file, by adding the code below to my form:

void __fastcall TFormMain::Print1Click(TObject *Sender) {
  if (PrintDialog1->Execute()) {
    Printer()->BeginDoc();
    PaintTo(Printer()->Handle, 10, 10);
    Printer()->NewPage();  // Tried with and without this line
    Printer()->EndDoc();
  }

Quote
}

Everything works if the form only contains TLabel or TEdit components.
If I add a TButton or TCheckBox component, it stops working.  This is
the case regardless of whether the components are enabled or disabled.

Can anyone please tell me how I can get a form containing a TCheckBox to
print?

Thanks.
JR

 

Re:Printing {*word*88}s on TCheckBox, TButton, etc.


Hi Justin,

Quote
> Can anyone please tell me how I can get a form containing a TCheckBox to
> print?

Don't use the PaintTo() method directly with the handle to the Printer's
device context (Printer()->Canvas->Handle).  Instead, create an
intermediate bitmap, then send the bitmap to the printer via the
StretchDIBits() API function.  Have a look at the following CAQ...

http://bcbcaq.freeservers.com/print_graphics.html

Better yet, use Joe C. Hecht's component...

http://home1.gte.net/joehecht/index.htm

Good luck!

--
Damon Chandler
http://bcbcaq.freeservers.com

Re:Printing {*word*88}s on TCheckBox, TButton, etc.


Thanks Damon!

I have a new version of TExcellentFormPrinter written in
native C++ specifically targeted for BCB due out any day!

http://home1.gte.net/joehecht/index.htm

Joe

Quote
Damon Chandler wrote:

> Hi Justin,
> > Can anyone please tell me how I can get a form containing a TCheckBox to
> > print?

> Don't use the PaintTo() method directly with the handle to the Printer's
> device context (Printer()->Canvas->Handle).  Instead, create an
> intermediate bitmap, then send the bitmap to the printer via the
> StretchDIBits() API function.  Have a look at the following CAQ...

> http://bcbcaq.freeservers.com/print_graphics.html

> Better yet, use Joe C. Hecht's component...

> http://home1.gte.net/joehecht/index.htm

> Good luck!

> --
> Damon Chandler
> http://bcbcaq.freeservers.com

--
Borland Delphi and BCB TForm printing got you down?
Try my TExcellentFormPrinter!
Joe C. Hecht
http://home1.gte.net/joehecht/index.htm

Re:Printing {*word*88}s on TCheckBox, TButton, etc.


Hello,

Thanks for the reply, I appreciate your response.  Seems like I have
opened a pandora's box.

Following your suggestion, I can send a bitmap (on which the controls
are drawn) to the printer and it comes out OK.  The main problem I can
see is that the control's caption is getting bitmapped which means its
printed resolution is poor.

But at least I am on the right track... thanks for the response.  I will
also look into Hecht's product for my more serious jobs.

JR

Quote
Damon Chandler wrote:

> Hi Justin,
> > Can anyone please tell me how I can get a form containing a TCheckBox to
> > print?

> Don't use the PaintTo() method directly with the handle to the Printer's
> device context (Printer()->Canvas->Handle).  Instead, create an
> intermediate bitmap, then send the bitmap to the printer via the
> StretchDIBits() API function.  Have a look at the following CAQ...

> http://bcbcaq.freeservers.com/print_graphics.html

> Better yet, use Joe C. Hecht's component...

> http://home1.gte.net/joehecht/index.htm

Re:Printing {*word*88}s on TCheckBox, TButton, etc.


I'm assuming you mean BCB5? I was just up there and its not ready. I
am! :-)

Larry
http://www.uncle-larry.com
---------------------------------

On Thu, 13 Jan 2000 19:44:16 -0600, "Joe C. Hecht" <joehe...@gte.net>
wrote:

Quote
>Thanks Damon!

>I have a new version of TExcellentFormPrinter written in
>native C++ specifically targeted for BCB due out any day!

>http://home1.gte.net/joehecht/index.htm

>Joe

>Damon Chandler wrote:

>> Hi Justin,
>> > Can anyone please tell me how I can get a form containing a TCheckBox to
>> > print?

>> Don't use the PaintTo() method directly with the handle to the Printer's
>> device context (Printer()->Canvas->Handle).  Instead, create an
>> intermediate bitmap, then send the bitmap to the printer via the
>> StretchDIBits() API function.  Have a look at the following CAQ...

>> http://bcbcaq.freeservers.com/print_graphics.html

>> Better yet, use Joe C. Hecht's component...

>> http://home1.gte.net/joehecht/index.htm

>> Good luck!

>> --
>> Damon Chandler
>> http://bcbcaq.freeservers.com

Other Threads