1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
void __fastcall TForm1::Button1Click(TObject *Sender)
{
TPrinter *Prntr = Printer();
// Rect de l'imprimante(marge gauche, marge haute, largeur imprimante - marge droite, hauteur imprimante - marge basse);
TRect Dest = Rect(20,20,Prntr->PageWidth - 20,Prntr->PageHeight - 20);
// Rect du PaintBox(gauche, haut, largeur, hauteur);
TRect Srce = Rect(0, 0, PaintBox1->Width, PaintBox1->Height);
// on demarre l'impression
Prntr->BeginDoc();
// on imprime
Prntr->Canvas->CopyRect(Dest, PaintBox1->Canvas, Srce);
// fin de l'impression
Prntr->EndDoc();
} |
Partager