1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
-------------------------------------------------------------------
implementation
uses printers;
procedure PrintPrinterWindow;
var
Bitmap : TBitMap; // BitMap intermédiaire
begin
Bitmap := TBitmap.Create;
Bitmap.canvas.CopyMode := cmSrcCopy;
Bitmap.Width := PrintVueWidth;
Bitmap.Height := PrintVueHeight;
// Copie dans le bitmap intermédiaire
Bitmap.Canvas.CopyRect(
// Rectangle de destination
Rect(0,0,Bitmap.Width,Bitmap.Height),
// Canevas d'origine: (le raster)
PlanRaster.Bitmap.Canvas,
// Rectangle du canevas d'origine à tracer dans le rectangle de destination:
Rect(PrintVueLeft,PrintVueTop,PrintVueWidth+PrintVueLeft,PrintVueHeight+PrintVueTop));
Printer.orientation := poPortrait;
Printer.BeginDoc;
try
// copie dans le canvas imprimante
{ Ne marche que sur certaines imprimantes...???
Printer.Canvas.CopyRect(
// Rectangle de destination (canevas imprimante)
Rect(PixMargeGauche,PixMargeHaute,PixFenWidth+PixMargeGauche,PixFenHeight+PixMargeHaute),
// Canevas d'origine
Bitmap.Canvas,
// Rectangle du canevas d'origine à tracer
Rect(0,0,Bitmap.Width,Bitmap.Height));
}
Printer.Canvas.StretchDraw({ idem CopyRect: Ne marche que sur certaines imprimantes...???}
// Rectangle de destination (canevas imprimante)
Rect(PixMargeGauche,PixMargeHaute,PixFenWidth+PixMargeGauche,PixFenHeight+PixMargeHaute),
Bitmap );
finally
Printer.EndDoc;
Bitmap.Free;
end;
end; |
Partager