Search the Community
Showing results for tags 'printing'.
Found 2 results
-
Hi. I used the code below to print Richedit in pre-XE Delphi for many years. Now it get stuck in the repeat loop: In my test, the first nextchar gives 571, in the next and all subsequent cals gives 570. Gence the loop hangs. Does Anybody have any ideas as to what has changed or what am I doing wrong? Printer.BeginDoc; try With Printer.Canvas Do Begin printresX := GetDeviceCaps( handle, LOGPIXELSX ); printresY := GetDeviceCaps( handle, LOGPIXELSY ); printarea:= Rect( printresX div 2, // 0.5 inch left margin printresY div 2, // 0.5 inch top margin Printer.PageWidth - (printresX div printresX), // 0.5 inch right margin Printer.PageHeight - (printresY-2) // 1 inch bottom ); richedit_outputarea := Rect( (printarea.left) * 1440 div printresX, ((printarea.top) * 1440 div printresY), (printarea.right) * 1440 div printresX, (printarea.bottom)* 1440 div printresY ); fmtRange.hDC := Handle; // printer handle fmtRange.hdcTarget := Handle; // ditto fmtRange.rc := richedit_outputarea; fmtRange.rcPage := Rect( 0, 0, Printer.PageWidth * 1440 div printresX, Printer.PageHeight * 1440 div printresY ); fmtRange.chrg.cpMin := 0; fmtRange.chrg.cpMax := richedit1a.GetTextLen; // remove characters that need not be printed from end of selection. // failing to do so screws up the repeat loop below. S:= richedit1a.Text; While (fmtRange.chrg.cpMax > 0) and (S[fmtRange.chrg.cpMax] <= ' ') Do Dec(fmtRange.chrg.cpMax); pageof:=0; //total number of pages Repeat // only count pages here. // Render the text nextChar := richedit1a.Perform( EM_FORMATRANGE, 0, Longint(@fmtRange)); fmtRange.rc := richedit_outputarea; Inc(pageof); If nextchar < fmtRange.chrg.cpMax Then Begin // more text to print fmtRange.chrg.cpMin := nextChar; End; { If } Until nextchar >= fmtRange.chrg.cpMax;
-
Hi, Is there a way to control which font and which size the IDE uses when printing source code? No matter what I select for the Editor, it prints everything in Courrier 12, which is ways too big. I can't find a setting controlling how the IDE would print the source files. Thanks for any clue Steve