Imprimer le texte d'un Memo
Bonjour,
J'essaie d'imprimer le contenu d'un mémo.
J'utilise le code suivant:
Code:
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();
}
} |
Mais à la sortie je récupère quelque chose du genre:
aaaaaaaaa bbbbbbbbb ccccccccc dddddddddddd
alors que ca devait etre comme dans le memo:
aaaaaaaaaaaaa
bbbbbbbbbbbbb
ccccccccccccc
Avez vous une solution svp?
Merci par avance.