见鬼,如何设置页边距等等。。。 (50分)

J

jobsxy

Unregistered / Unconfirmed
GUEST, unregistred user!
用QuickReport做报表,
然后调用打印设置:PrintDialog1.Execute;
里面却没有设置页边距等等,如何调出能够设置页边距的对话框呢?
就象对QuickRep右链击Report Setting对话框一样,只不好那个是英文的
 
用TPrintSetUpDialog
 
不行,出不来
 
如果直接用printer.canvas ,在canvas中控制:
The VCL TPrinter object encapsulates details of Windows printers. To get a list of installed and available printers, use the Printers property. The CLX TPrinter object is a paint device that paints on a printer. It generates postscript and sends that to lpr, lp, or another print command.
Both printer objects use a TCanvas (which is identical to the form's TCanvas) which means that anything that can be drawn on a form can be printed as well. To print an image, call the begin
Doc method followed by whatever canvas graphics you want to print (including text through the TextOut method) and send the job to the printer by calling the EndDoc method.
This example uses a button and a memo on a form. When the user clicks the button, the content of the memo is printed with a 200-pixel border around the page.
To run this example successfully, add Printers to your uses clause.
procedure TForm1.Button1Click(Sender: TObject);
var
r: TRect;
i: Integer;
begin
with Printerdo
begin
r := Rect(200,200,(Pagewidth - 200),(PageHeight - 200));
begin
Doc;
for i := 0 to Memo1.Lines.Countdo
Canvas.TextOut(200,200 + (i *
Canvas.TextHeight(Memo1.Lines.Strings)),
Memo1.Lines.Strings);
Canvas.Brush.Color := clBlack;
Canvas.FrameRect(r);
EndDoc;
end;

end;
 
老兄,改用rbulider算了
 
Quickreport.Page.TopMargin
 
to jsxjd:你所说的办法需要我直接把表画到打印机上,太麻烦啦。
to mor:那我得一个个去设,如顶端,左边,右边,页脚等等,有没有什么办法直接
调出一个对话框?
PrintSetUpDialog或printdialog都没办法设置页边距,我记得我以前好象见过可以设置的,
不知道会不会跟我的打印机或操作系统有关(lq-2000KIII,win2000)。
 
难道真的没办法?
 
TQuickRep.Page.BottomMargin.LeftMargin
TQuickRep.Page.BottomMargin.RightMargin
TQuickRep.Page.BottomMargin.TopMargin
TQuickRep.Page.BottomMargin.BottomMargin
有个API比较复杂,参数很多:
procedure TForm1.Button1Click(Sender: TObject);
var
d:TPAGESETUPDLG;
begin
d.lStructSize :=sizeOf(d);
d.hwndOwner :=handle;
pagesetupdlg(d);
////
end;
 
你可以 看一下FASTREPORT的源码,里面请得很详细。
 
多人接受答案了。
 
顶部