在RBuilder中如何使用Components属性(200分)

  • 主题发起人 苍山@狼
  • 开始时间

苍山@狼

Unregistered / Unconfirmed
GUEST, unregistred user!
我在RBuilder中的子报表放了5个 ppLabel 分别命名 ppLab_1……ppLab_5,同时属性
分别tag设为1……5
然后我编辑函数如下:
procedure TForm1.Button1Click(Sender: TObject);
var
i:integer;
TemLab:TppLabel;
begin
for i:=0 to Form1.ppReport1.ComponentCount-1 do
begin
showmessage('hhhh');
if Form1.ppReport1.Components is TppLabel then
begin
showmessage('kkk');
TemLab:= (Form1.ppReport1.Components as TppLabel);
if copy(TemLab.Name,1,6)='ppLab_' then
begin
showmessage('good');
TemLab.Caption :='good';
TemLab.Text := 'hello';
TemLab.UserName :='killer';
end;
end;
end;
ppReport1.Print ;
end;
我想要通过循环,对所有的 ppLabel 赋值,但是我运行该程序,在三个showmessage函数
中只执行了第一个,并且只执行了三次。请问各位大虾,我的程序问题在哪里?该如何
解决?
 
Form1.ppReport1.ComponentCount 改为Form1.ComponentCount ,and try again.
 
接受答案,非常感谢!
 
顶部