如何改寫以 case 印出適當報表 |
缺席
|
u86210779
一般會員 發表:16 回覆:41 積分:16 註冊:2004-06-08 發送簡訊給我 |
請問各位先進:
<textarea class="delphi" rows="10" cols="60" name="code"> procedure TfmPrint.Master; begin with RadioGroup1 do case ItemIndex of 0: SetCust;//客戶資料表 1: SetSply;//廠商 end; end; procedure TfmPrint.SetCust; begin ptCust := TptCust.Create(Self); SetReport(ptCust, RadioGroup3.ItemIndex=1); end; procedure TfmPrint.SetSply; begin ptSply := TptSply.Create(Self); SetReport(ptSply, RadioGroup3.ItemIndex=1); end; ........ //如何改寫為 procedure TfmPrint.Master; begin with RadioGroup1 do case ItemIndex of 0: SetPrint(ptCust);//客戶資料表 1: SetPrint(ptSply);//廠商 end; end; procedure TfmPrint.SetPrint(ptPrint:???); begin ptPrint := TptPrint.Create(Self); SetReport(ptPrint, RadioGroup3.ItemIndex=1); end; procedure SetReport(vReport: TQuickRep; vPreView: boolean); var i: integer; begin with vReport do try Prepare; for i := 1 to ComponentCount - 1 do if Components[i] is TQRLabel then with (Components[i] as TQRLabel) do if name = 'QRLabelTotPage' then Caption := IntToStr(QRPrinter.PageCount); if vPreView then Print else Preview; finally Free; QRPrinter := nil; end; end; </textarea> 感謝你撥空看我的問題. |
bruce
中階會員 發表:19 回覆:121 積分:83 註冊:2002-04-16 發送簡訊給我 |
//如何改寫為
更改如下: 您的問題應該是,如何傳遞物件至一個程序,把物件當成變數型態的一種就對了。 |
u86210779
一般會員 發表:16 回覆:41 積分:16 註冊:2004-06-08 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |