Memo打印

Memo打印
 
Memo打印
 
加入Printers单元,

var
  Left,Top,PageHeight,i,x,y,LineSpace : integer;
begin
   Top := 20;
   Left := 20;
    y := Top; //Top 起始行的位置,比如设置 Top := 20;
    x := Left; //Left 左边的起始位置,比如设置:Left := 20;
    PageHeight := 2600; //A4得纸张大概是这么多,我既不太清,你可以通过某个过程先得到这个数据,
    LineSpace := 24; //行间距
    Printer.BeginDoc;
     for i := 0 to Memo1.Lines.Count - 1 do
       begin
        Printer.Canvas.TextOut(x,y,Memo1.Lines[i]);
        y := y + LineSpace;
         if(y > PageHeight - Top) then
           begin
            Printer.NewPage;
            y := Top;
           end;
       end;
    Printer.EndDoc;
end;





你可能感兴趣的:(打印)