Главная страница | назад





Article #15936: Setting the MaxPage property of the PrintDialog component

 Question and Answer Database
FAQ936D.txt Setting the MaxPage property of the PrintDialog component
Category :Object Pascal
Platform :All
Product :All 32 bit
Question:
When I set the MaxPage property of the PrintDialog component, the
VCL always adds one to the number of pages shown in the dialog, and
after execution, the Max page property does not change. Is this a bug?
Answer:
The VCL simply wraps the Windows common print dialog. You should
fill in all the fields before executing the dialog, and after
execution. Check the PrintDialog's FromPage and ToPage properties for
the pages to print.
Example:
procedure TForm1.Button1Click(Sender: TObject);
begin
PrintDialog1.Options := [poPageNums];
PrintDialog1.PrintRange := prPageNums;
PrintDialog1.MinPage := 1;
PrintDialog1.MaxPage := 5;
PrintDialog1.FromPage := 1;
PrintDialog1.ToPage := 5;
if PrintDialog1.Execute then begin
ShowMessage(IntToStr(PrintDialog1.FromPage));
SdhowMessage(IntToStr(PrintDialog1.ToPage));
end;
end;
7/16/98 4:31:28 PM

Last Modified: 01-SEP-99