I always set the printerfont colour and size, they probably have sensible defaults but maybe not ? eg
Printer.Canvas.Font.Size := 12;
Printer.Canvas.Font.Color := clBlack;
Anyway, as Jamie said, you need to check the content, 'Line' should increase with each loop (But MUST be reset when you start a new page by the way). To make it easy to debug, you might like to add a line or two -
procedure TfrmPrinterSetUp.PrintTStrings(Lst : TStrings) ;
var
I,
Line : Integer;
AString : string; // add this
begin
I := 0;
Line := 0 ;
Printer.BeginDoc ;
showmessage(IntToStr(Lst.Count-1));
for I := 0 to Lst.Count - 1 do begin
AString := List[i]; // and add this
Printer.Canvas.TextOut(0, Line, Lst[I]); // set debugger to stop here
{Font.Height is calculated as -Font.Size * 72 / Font.PixelsPerInch which returns
a negative number. So Abs() is applied to the Height to make it a non-negative
value}
Line := Line + Abs(Printer.Canvas.Font.Height);
if (Line >= Printer.PageHeight) then
Printer.NewPage;
end;
Printer.EndDoc;
end;
A bit easier for a beginner, set the debugger up to stop on the line AFTER "AString ;= " line, click on that line, then click in the 'left gutter' (the area to the left, where line number appear). That will set a red background under that line meaning the debugger will stop there.
A new project will have debugging turned on, so, now just click 'run', your app will startup, get as far as that line and stop, waiting for you to reclick the green 'run' triangle. While its in that waiting mode, hover your mouse over variables of interest and you will see their current value. You can step through, line by line with eg F8
Davo