全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:1389
推到 Plurk!
推到 Facebook!

QRShape 和StringGrid 問題

答題得分者是:P.D.
letkiss2002
一般會員


發表:4
回覆:9
積分:2
註冊:2009-10-02

發送簡訊給我
#1 引用回覆 回覆 發表時間:2012-01-31 15:43:02 IP:210.71.xxx.xxx 訂閱
不好意思,小弟還再研習可以請教大家
QRShape1~9 命名為Y1~Y9
取StringGrid1.Cells[1, i] 的值
i 值如果為1 ,Y1就顯示出來,有正確的寫法嗎?
以下是我寫的

QRLabel1.Caption := MainForm1.StringGrid1.Cells[1, i];
QRLabel2.Caption := MainForm1.StringGrid1.Cells[2, i];
QRLabel3.Caption := MainForm1.StringGrid1.Cells[3, i];
QRLabel4.Caption := MainForm1.StringGrid1.Cells[4, i];
QRLabel5.Caption := MainForm1.StringGrid1.Cells[5, i];
QRLabel6.Caption := MainForm1.StringGrid1.Cells[6, i];


TQRShape(FindComponent('y' Copy(MainForm1.StringGrid1.Cells[1, i])).Enabled:=True; (這行一直錯,但不知錯在那)

inc(i);
------
sky
P.D.
版主


發表:603
回覆:4038
積分:3874
註冊:2006-10-31

發送簡訊給我
#2 引用回覆 回覆 發表時間:2012-01-31 21:42:14 IP:118.169.xxx.xxx 未訂閱
1.錯誤訊息?
2.既然是迴圈, 出錯時是在 i=? 的時候?
3.你確定 Cells[r,c] 有內存嗎?
===================引 用 letkiss2002 文 章===================
不好意思,小弟還再研習可以請教大家
QRShape1~9 命名為Y1~Y9
取StringGrid1.Cells[1, i] 的值
i 值如果為1 ,Y1就顯示出來,有正確的寫法嗎?
以下是我寫的

QRLabel1.Caption := MainForm1.StringGrid1.Cells[1, i];
QRLabel2.Caption := MainForm1.StringGrid1.Cells[2, i];
QRLabel3.Caption := MainForm1.StringGrid1.Cells[3, i];
QRLabel4.Caption := MainForm1.StringGrid1.Cells[4, i];
QRLabel5.Caption := MainForm1.StringGrid1.Cells[5, i];
QRLabel6.Caption := MainForm1.StringGrid1.Cells[6, i];


TQRShape(FindComponent('y' Copy(MainForm1.StringGrid1.Cells[1, i])).Enabled:=True; (這行一直錯,但不知錯在那)

inc(i);
編輯記錄
P.D. 重新編輯於 2012-01-31 06:44:15, 註解 無‧
letkiss2002
一般會員


發表:4
回覆:9
積分:2
註冊:2009-10-02

發送簡訊給我
#3 引用回覆 回覆 發表時間:2012-02-01 10:34:52 IP:210.71.xxx.xxx 訂閱
unit MDE800401;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, QRCtrls, QuickRpt, ExtCtrls;
type
TRMDE800401 = class(TForm)
QuickRep1: TQuickRep;
DetailBand1: TQRBand;
y1: TQRShape;
y2: TQRShape;
y3: TQRShape;
y4: TQRShape;
y5: TQRShape;
y6: TQRShape;
QRLabel1: TQRLabel;
QRLabel2: TQRLabel;
QRLabel3: TQRLabel;
QRLabel4: TQRLabel;
QRLabel5: TQRLabel;
QRLabel6: TQRLabel;
QRLabel7: TQRLabel;
procedure QuickRep1NeedData(Sender: TObject; var MoreData: Boolean);
procedure DetailBand1BeforePrint(Sender: TQRCustomBand;
var PrintBand: Boolean);
private
{ Private declarations }
public
{ Public declarations }
end;
var
RMDE800401: TRMDE800401;
implementation
{$R *.dfm}
uses Mainform;
var FRow,i:integer;

procedure TRMDE800401.QuickRep1NeedData(Sender: TObject;
var MoreData: Boolean);
begin
if i <= MainForm1.StringGrid1.RowCount - 1 then
moredata := true else moredata := false ;
QuickRep1.NewPage;
end;
procedure TRMDE800401.DetailBand1BeforePrint(Sender: TQRCustomBand;
var PrintBand: Boolean);
begin
QRLabel1.Caption := MainForm1.StringGrid1.Cells[1, i];
QRLabel2.Caption := MainForm1.StringGrid1.Cells[2, i];
QRLabel3.Caption := MainForm1.StringGrid1.Cells[3, i];
QRLabel4.Caption := MainForm1.StringGrid1.Cells[4, i];
QRLabel5.Caption := MainForm1.StringGrid1.Cells[5, i];
QRLabel6.Caption := MainForm1.StringGrid1.Cells[6, i];

TQRShape(FindComponent('y' Copy(MainForm1.StringGrid1.Cells[1, i])).Enabled:=True;// ((((( [Error] MDE800401.pas(127): Not enough actual parameters))))) 錯誤訊息

end;
end.
------
sky
P.D.
版主


發表:603
回覆:4038
積分:3874
註冊:2006-10-31

發送簡訊給我
#4 引用回覆 回覆 發表時間:2012-02-01 23:40:21 IP:118.169.xxx.xxx 未訂閱
1. "TQRShape(FindComponent('y'+Copy(MainForm1.StringGrid1.Cells[1, i]))." 
請改成以下藍字, 我不建議直接使用 Tobject 來操作
2.copy() 函數參數不足, 我不幫你改, 請自已找出copy 的參數要如何下, 這是最基本的功課
3.在TQRShape這一行還有一個更嚴重的錯誤, 你仔細再看一下, 我有特別提示出來了哦!
===================引 用 letkiss2002 文 章===================
unit MDE800401;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, QRCtrls, QuickRpt, ExtCtrls;
.... 略

procedure TRMDE800401.QuickRep1NeedData(Sender: TObject;
var MoreData: Boolean);
begin
if i <= MainForm1.StringGrid1.RowCount - 1 then
moredata := true else moredata := false ;
QuickRep1.NewPage;
end;
procedure TRMDE800401.DetailBand1BeforePrint(Sender: TQRCustomBand;
var PrintBand: Boolean);
myQRshape:= TQRShape(FindComponent('y' ));
if myQRshape<>nil then myQRshape.Eanbled:= True;


end;
end.
編輯記錄
P.D. 重新編輯於 2012-02-01 19:29:34, 註解 無‧
P.D. 重新編輯於 2012-02-01 19:32:29, 註解 無‧
letkiss2002
一般會員


發表:4
回覆:9
積分:2
註冊:2009-10-02

發送簡訊給我
#5 引用回覆 回覆 發表時間:2012-02-02 11:53:45 IP:210.71.xxx.xxx 訂閱
謝謝大大祥細的解說^^~~~~受惠很多
我想再請教另一個問題
我可以預覽資料,但再列印有出現"printng progress"但卻印不出任何資料
(就算我轉PDF 也無法轉出任何資料)



===================引 用 P.D. 文 章===================
1. "TQRShape(FindComponent('y' Copy(MainForm1.StringGrid1.Cells[1, i]))."
請改成以下藍字, 我不建議直接使用 Tobject 來操作
2.copy() 函數參數不足, 我不幫你改, 請自已找出copy 的參數要如何下, 這是最基本的功課
3.在TQRShape這一行還有一個更嚴重的錯誤, 你仔細再看一下, 我有特別提示出來了哦!
===================引 用 letkiss2002 文 章===================
unit MDE800401;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, QRCtrls, QuickRpt, ExtCtrls;
.... 略

procedure TRMDE800401.QuickRep1NeedData(Sender: TObject;
var MoreData: Boolean);
begin
if i <= MainForm1.StringGrid1.RowCount - 1 then
moredata := true else moredata := false ;
QuickRep1.NewPage;
end;
procedure TRMDE800401.DetailBand1BeforePrint(Sender: TQRCustomBand;
var PrintBand: Boolean);
myQRshape:= TQRShape(FindComponent('y' ));
if myQRshape<>nil then myQRshape.Eanbled:= True;


end;
end.
------
sky
P.D.
版主


發表:603
回覆:4038
積分:3874
註冊:2006-10-31

發送簡訊給我
#6 引用回覆 回覆 發表時間:2012-02-03 01:58:37 IP:118.169.xxx.xxx 未訂閱
1.我不用QR已經好久了
2.如有不同問題, 建議你另發帖描述, 要不然這個案子沒完沒了, 大家在共享搜尋文章也很麻煩
===================引 用 letkiss2002 文 章===================
謝謝大大祥細的解說^^~~~~受惠很多
我想再請教另一個問題
我可以預覽資料,但再列印有出現"printng progress"但卻印不出任何資料
(就算我轉PDF也無法轉出任何資料)



letkiss2002
一般會員


發表:4
回覆:9
積分:2
註冊:2009-10-02

發送簡訊給我
#7 引用回覆 回覆 發表時間:2012-02-03 08:37:55 IP:210.71.xxx.xxx 訂閱
恩恩~~~謝謝分享^^
------
sky
系統時間:2024-04-24 22:10:32
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!