using tcustomform.print

This is very sad. All I want to do is print the form out.
help says that
print;
will do it by getting a bmp image of the form and feeding it to the printer.
Fine. That's what I want. A nice simple print of the form.
But blank paper keeps coming out. (I've checked the ink <g>)
My form has panels and captions and a bmp background, but simply
putting a label on and using 'print ;' doesn't work.
I've tried 'form1.print ;' but still the same result.
What am I doing wrong?

what is the easiest way to print my form. I thought this was it!
 
chriswoodAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

IndefreiCommented:
var
SRect,DRect: TRect; // Source Destination Rectangle
Tmp : TPicture;
begin
// Initialize the rectangles
Tmp.Bitmap.Canvas.copyrect( dRect, Form1.Canvas,SRect);
assign it to image1
Print the Bitmap with
e.g.
Printer.Canvas.StretchDraw(dRect, Image1.Picture.Graphic);
regards
Indi
0
IndefreiCommented:
Chriswood,
i think you have to use after begin
Tmp :=TPicture.Create;
and in the end
tmp.free;

>>assign it to image1
Image1.Picture.Assign(Tmp);
and use
Printer.BeginDoc;
Printer.EndDoc;
for printing
Indi
0
DrDelphiCommented:
Are you sure that you're getting nothing? You might be getting a very small image printed on the page. The Print method does no scaling at all, it just takes the form's image and throws it at the printer. It might be huge, it might be a postage stamp.
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

sburckCommented:
I tried this, with a button on a blank form, and it printed out fine.  Looking in the help, though, I see a direction.  The print method uses the GetFormImage method.  You can use the GetFormImage method and put the bitmap to a file or the clipboard, and see if DrDelphi is right (scaling problem), or something else (printer driver).

0
sburckCommented:
On second thought, looking more closely at the source of TCustomForm.Print, if DrDelphi is right, set the PrintScale method to poPrintToFit, and that will either fix your problem or eliminate one more idea.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
chriswoodAuthor Commented:
thanks to you 3. Actually sburck's comment helped me solve this. He confirmed that it should simply work! I tried with a different printer and it worked first time. I don't know what's wrong with my Hp laserjet 4000 but it was the printer not my programming...

But I would have gone round in circles without that... thanks again,
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.