1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
if (MessageBox (NULL, "Voulez-vous vraiment imprimer ?", "Print",MB_YESNO) == IDYES)
{
int FontHeight, LinesOnPage;
TCanvas *pcanvas;
Printer()->BeginDoc();
pcanvas = Printer()->Canvas;
FontHeight = pcanvas->Font->Height;
LinesOnPage = Printer()->PageHeight / -FontHeight;
for (int i = 0, j = 0; i < Memo1->Lines->Count; i++, j++)
{
if ((i > 1) && (i % LinesOnPage == 0))
{
j = 0;
Printer()->NewPage();
}
pcanvas->TextOut (10, ((j * -FontHeight) + 10),Memo1->Lines->Text]);
Printer()->EndDoc();
}
} |
Partager