Solved

Printer Canvas Question

Posted on 1998-10-10
5
247 Views
Last Modified: 2010-04-06
I'm printing a form several times, running a loop and a procedure that uses the printer.begindoc and printer.enddoc method. I paint on the canvas using the textout procedure.

Here is my question: what is the most efficient way of clearing the canvas in between pages? Attempting to free and recreate the canvas causes an access error.

Here's a code chunk: the procedure writes sundry things to the canvas:

   if PrintDialog1.Execute then
      with printer do
         for i := 0 to 1 do begin
            main.caption := 'Printing ' + datetostr(tempdate + i);
            BeginDoc;
            canvas.font.size := 12;
            fillshift(tempdate + i,week,1 + i);
            EndDoc;
         end;
0
Comment
Question by:oneeye
  • 3
  • 2
5 Comments
 

Author Comment

by:oneeye
Comment Utility
Edited text of question
0
 
LVL 4

Expert Comment

by:dwwang
Comment Utility
Have you every tried not to "clear" the canvas?

As I understand, you needn't clear the canvas,
since when you begindoc, the printer canvas is a new one,
which is OK to draw for the next page you want to print.
0
 

Author Comment

by:oneeye
Comment Utility
My second and subsequent pages appear to be overlayed on top of the first, so I can but assume that something is not clearing it.
0
 

Author Comment

by:oneeye
Comment Utility
Argh.

I'm such an idiot. What appears to be one canvas overwriting the other was the font style.. fsUnderLined which I left turned on.

Since you were correct, resubmit and I'll approve the point transfer.
0
 
LVL 4

Accepted Solution

by:
dwwang earned 50 total points
Comment Utility
Ok, good luck.

I sometimes make such kind of mistakes also.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now