Chris,
        Here's the simplest way I found.  Make sure you add the Printers
unit to your uses clause.  As you can see I also use the standard Delphi
Print dialog but it isn't absolutely necessary.

////////////////////////////// CODE STARTS HERE
//////////////////////////////////

procedure TMemoF.PrintActExecute(Sender: TObject);
Var
    x, y, i: Integer;
Begin
    If PrintDlg.Execute Then
    Begin
        With Printer Do
        Begin;
            BeginDoc;
            x := 100;
            y := 100;
            With canvas Do
            Begin
                For i := 1 To MMemo.lines.count - 1 Do
                Begin
                    textout(x, y, MMemo.lines[i]);
                    inc(y, 100);
                    If y > 2900 Then
                    Begin
                        Newpage;
                        y := 100;
                    End;
                End;
            End;
            EndDoc;
        End;
    End;
end;

////////////////////////// CODE ENDS HERE
///////////////////////////////////////////

from Robert Meek dba Tangentals Design


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Chris Stebbing
Sent: Tuesday, January 24, 2006 11:27 PM
To: Delphi List
Subject: Printing a Memo

Hi All,

this is going to sound like a really stupid question, but how do I 
print the contents of a Memo?  I have just recently upgraded to 
Delphi 2005 and have the JVCL components.  I used to use the 
DreamCompany components, and their TDCMemo had a "print" method which 
was fantastic.....

So, how to quickly and easily print a memo?

Cheers,
Chris.

_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi

_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi

Reply via email to