From: Alexander S.K. <al...@be...> - 2004-03-18 06:59:37
|
On 17.03.2004 16:01, Sandro R. R. Freire <san...@ya...> wrote: SRRF> Please it verifies if the code below can be adapted for the use of the HwGUI SRRF> sending an archive txt SRRF> #include <Printers.hpp> SRRF> void __fastcall TForm1::Button1Click(TObject *Sender) SRRF> { SRRF> TPrinter Prntr = Printer(); SRRF> TRect r = Rect(200,200,Prntr->PageWidth - 200,Prntr->PageHeight - 200); Prntr->>BeginDoc(); Prntr->>Canvas->TextRect(r, 200, 200, Memo1->Lines->Text); Prntr->>EndDoc(); SRRF> } Yes, it's possible: Function Main Local oPrinter := HPrinter():New() Local aPrnCoors := GetDeviceArea( oPrinter:hDCPrn ) Local cText := Memoread( "aprint.prg" ) oPrinter:StartDoc() oPrinter:StartPage() oPrinter:Say( cText,100,100,aPrnCoors[1]-100,aPrnCoors[2]-100 ) oPrinter:EndPage() oPrinter:EndDoc() oPrinter:End() Return Of course, this is simplest code. In a real application you will need to determine the size of a printed text and divide it to pages, if necessary. Probably, it will be needed to set other font. Sure, HPrinter should be extended - the size of the device area should be determined automatically in HPrinter():New(). Regards, Alexander http://kresin.belgorod.su |