|
Drawing with TPrintJob
To draw the graphics just use the passed TheCanvas and TheRect. The Target parameter can be used if you want to make the different output for printer and for preview. To call the WinAPI graphic functions just use the Handle property of TheCanvas parameter.
procedure TForm1.PrintJob1Draw(Sender: TObject; TheCanvas: TCanvas;
PageIndex: Integer; TheRect: TRect; Area: TDrawArea;
Target: TDrawTarget);
begin
with TheCanvas,TheRect do
if Area=daPage then
begin
// drawing the rectangle using TCanvas method
Rectangle(Left,Top,Right,Bottom);
// setting the font using TCanvas property
Font.Size:=50;
// drawing the text using WinAPI function
// (the Handle property of TheCanvas is used)
DrawText(Handle,'Print Suite',-1,TheRect,
DT_SINGLELINE or DT_CENTER or DT_VCENTER);
end;
end;
|