看不懂範例... |
答題得分者是:scottliou
|
mygod
一般會員 發表:52 回覆:64 積分:23 註冊:2002-09-10 發送簡訊給我 |
在delphi6中所附的Borland\Delphi6\Demos\QuickRpt\Qr3範例
其中Form--frmMasterDetail中的
procedure TfrmMasterDetail.DetailBand1BeforePrint(Sender: TQRCustomBand; var PrintBand: Boolean);
procedure TfrmMasterDetail.QRGroupCustBeforePrint(Sender: TQRCustomBand; var PrintBand: Boolean);
看的不是很懂...有人能幫個忙解釋一下嗎?? 謝謝 oh~mygod
------
oh~mygod |
scottliou
版主 發表:16 回覆:56 積分:47 註冊:2002-03-14 發送簡訊給我 |
在delphi6中所附的Borland\Delphi6\Demos\QuickRpt\Qr3範例
其中Form--frmMasterDetail中的
procedure TfrmMasterDetail.DetailBand1BeforePrint(Sender: TQRCustomBand; var PrintBand: Boolean);
這一行是要印DetailBand之前讓你自行設定資訊的Event ex1: 你可以要列印之前設定是否要列印此行 PrintBand:=tbDetailisPrint.value; 如果PrintBand = true 則印此行 否則不印 ex2: 你可以要列印之前設定此行的顏色 if tbDetailSEQ.Value mod 2=1 then TQRCUstomBand(Sender).Color:=clRed else TQRCUstomBand(Sender).Color:=clWhite; ..................procedure TfrmMasterDetail.QRGroupCustBeforePrint(Sender: TQRCustomBand; var PrintBand: Boolean); 這一行是要印GroupCust之前讓你自行設定資訊的Event ex1: 你可以要列印之前設定是否要將統計結果設為0 SumTotal:=0; ........................自己可靈活運用 Sender:TQRCustomBand 目前列印的QRBand PrintBand: Boolean 此Band可自己設定是否要印如此而已 ~~~~~~~~~~~~~~~~ 有夢想最美......
------
~~~~~~~~~~~~~~~~ 有夢想最美...... |
mygod
一般會員 發表:52 回覆:64 積分:23 註冊:2002-09-10 發送簡訊給我 |
謝謝這位兄台,不過...好像不是我說的那個...是不是版本不一樣啊? procedure TfrmMasterDetail.DetailBand1BeforePrint(Sender: TQRCustomBand;
var PrintBand: Boolean);
begin
// If there are no subdetails, then we print this band. Otherwise we
// let the group header print the controls from this band. Group bands
// can be reprinted on page breaks, which detail and subdetails can't do.
qryOrders.First;
PrintBand := qryOrders.EOF; // If it's our turn to print and the group band has our controls, then
// we take them back.
if PrintBand and (Sender.ControlCount = 0) then
with QRGroupCust do
while ControlCount > 0 do
Controls[0].Parent := Sender;
end; procedure TfrmMasterDetail.QRGroupCustBeforePrint(Sender: TQRCustomBand;
var PrintBand: Boolean);
begin
// We grab the detail band fields right from under it.
if Sender.ControlCount = 0 then
with DetailBand1 do
While ControlCount > 0 do
Controls[0].Parent := Sender;
end; oh~mygod
------
oh~mygod |
ccchen
版主 發表:61 回覆:940 積分:1394 註冊:2002-04-15 發送簡訊給我 |
procedure TfrmMasterDetail.DetailBand1BeforePrint(Sender: TQRCustomBand; var PrintBand: Boolean);
此程序會在每一個DetailBand列印前執行
procedure TfrmMasterDetail.QRGroupCustBeforePrint(Sender: TQRCustomBand; var PrintBand: Boolean);
此程序會在Report開始列印前執行 scottliou只不過是用Sample告訴你, 你可以利用這些Event做什麼.正符合你所問
qryOrders.First; PrintBand := qryOrders.EOF; //若qryOrders為End of file設PrintBand為False //PrintBand設為False會使此Band不列印 if PrintBand and (Sender.ControlCount = 0) then //若PrintBand=True //且band上無元件controlcount=0 //下面程式將QRGroupCust上之所有元件移至本band (i.e)Sender with QRGroupCust do while ControlCount > 0 do Controls[0].Parent := Sender;//更改元件之Parent使原在QRGouprCust //上之元件至本band |
mygod
一般會員 發表:52 回覆:64 積分:23 註冊:2002-09-10 發送簡訊給我 |
|
paikang
一般會員 發表:1 回覆:7 積分:11 註冊:2002-10-08 發送簡訊給我 |
qryOrders 是 Detail. 當 Master 的指標移動時, qryOrders 會重新開啟.
裡頭寫的這兩行的意思:
qryOrders.First;
PrintBand := qryOrders.EOF;
就是當 qryOrders 重新開啟時, 偵測 qryOrders 有沒有資料, 如果 RecordCount = 0 的話, qryOrders 的 BOF 跟 EOF 都是成立的.
那兩行的意思等於:
if qryOrders.RecordCount = 0 then PrintBand := True else PrintBand := False;-- 為什麼要這麼做, 詳原文說明 // If there are no subdetails, then we print this band. Otherwise we // let the group header print the controls from this band. Group bands // can be reprinted on page breaks, which detail and subdetails can't do. 我的簽名~ http://www.watermonster.org/phpBB/index.php
------
我的簽名~ http://www.watermonster.org/phpBB/index.php |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |