如何打印MEMO里面的内容?

解决方案 »

  1.   

    //用这个试试,用Delphi的Demos里面的一段代码修改的,没有运行过
      Screen.Cursor := crHourGlass; { <-- nice detail }
      try
        Printer.BeginDoc;       { <-- start printer job }
        try
          { now print some text on printer.canvas }
          With Printer.Canvas do
          begin
            Font.Name:='宋体';
            Font.Size:=9;             { <-- set the font size }
            Font.Style:=[];
            TextOut(0,0,Memo1.Text);   { <-- print some text }
          end;      Printer.EndDoc; { <-- end job and print !! }
        except
          on Exception do  { just in case an error happens... }
          Begin
            Printer.Abort;
            Printer.EndDoc;
            Raise;       { <-- raise up the exception !!! }
          end;
        end;
      finally
        Screen.Cursor:=crDefault; { <-- restore cursor }
      end;