인쇄 캔버스를 사용하여 여러 페이지를 인쇄하는 방법은 무엇입니까? lineto 및 textout을 사용하여 캔버스에 출력물을 생성 하시겠습니까? 캔버스는 단일 페이지에서 잘 작동합니다. 이것은 첫 번째 페이지에 일반 인쇄를 사용하고 있습니다. 그런 다음 copyrect를 프린터 캔버스에 사용하고 새 페이지를 발행했지만 후속 페이지는 공백입니다. 한 가지 질문에서 그들은 PrintPage에 대해 이야기하고있는 것을 보았습니다. 저는 Lazarus와 같은 기능이나 방법을 보지 못했습니다. 도움이되는지 모르는 코드입니다.캔버스 기능을 사용하여 여러 페이지 인쇄 LineTo 및 Textout
kBracketTree: with TestTableForSpeciesData, Printer.Canvas do
begin
intCPLngth := Origin.ttoBracket.Height * 5;
intCPWdth := Origin.ttoBracket.Width * 5;
if imgPrintView.Canvas = nil then
imgPrintView.Canvas.Create;
imgPrintView.Height := intCPLngth; // * 6 div 5;
imgPrintView.Width := intCPWdth; // * 6 div 5;
intVPages := intCPLngth div intHeight + 1;
intHPages := intCPWdth div intWidth + 1;
DrawScale(dblScale);
DrawBracket(HomeVrtcl);
DrawBracketLabel(Species[NodeCount].VrtclPosition, Species[NodeCount].EndSegment);
DrawBracketLabel(Species[NodeCount - 1].VrtclPosition, Species[NodeCount - 1].EndSegment);
intNdLvl := 1;
while boolMoreNodeLevels(intNdLvl) do
begin
for inx := 0 to NodeCount - 2 do
if Species[inx].NodeLevel = intNdLvl then
DrawBracketLabel(Species[inx].VrtclPosition, Species[inx].EndSegment);
inc(intNdLvl);
end;
if boolBootStrap then
for inx := SpeciesCount to NodeCount do
DrawBootStrapLabel(Species[inx].VrtclPosition, BSPercent[inx - SpeciesCount], 5, 5, 55);
if (intVPages > 1) or (intHPages > 1) then
begin
if intVPages > 1 then
if intHPages = 1 then
begin
intVStart := 2;
intHStart := 1;
end
else
begin
intVStart := 1;
intHStart := 2;
end
else
begin
intVStart := 1;
intHStart := 2;
end;
for iny := intVStart to intVPages do
begin
Pen.Color := clBlack;
Brush.Style := bsSolid;
Brush.Color := clWhite;
Clear;
with rctPrnt do
begin
Left := 0;
Top := 0;
if intCPLngth > intHeight * iny then
Bottom := intHeight - 1
else
Bottom := intCPLngth - intHeight * (iny - 1) - 1;
end;
with rctSlctd do
begin
Top := intHeight * (iny - 1);
if intCPLngth > intHeight * iny then
Bottom := intHeight * iny - 1
else
Bottom := intCPLngth;
end;
for inx := intHStart to intHPages do
begin
NewPage;
with rctPrnt do
if intCPWdth > intWidth * inx then
Right := intWidth - 1
else
Right := intCPWdth - intWidth * (inx - 1) - 1;
with rctSlctd do
begin
Left := intWidth * (inx - 1);
if intCPWdth > intWidth * inx then
Right := intWidth * inx - 1
else
Right := intCPWdth - 1;
end;
Canvas.Rectangle(0, 0, intWidth - 1, intHeight - 1);
Canvas.CopyRect(rctPrnt, imgPrintView.Canvas, rctSlctd);
Canvas.Refresh;
end;
intHStart := 1;
end;
end;
한 단어의 텍스트를 인쇄하고 새 페이지를 시작한 다음 다시 인쇄하는 MCVE를 제작합니다. 우리는 모든 코드를 지키고 싶지 않습니다. 단순화하십시오. –