根据组件名称,来定位到组件,并且更改组件属性
主要用到Delphi FindComponent 函数
//循环将RzBackground1 - #12的图片改为Sample中的图片 for I := 1 to 12 do begin TRzBackground(FindComponent('RzBackground'+IntToStr(I))).Texture := RzBackground_Sample.Texture; end; //将组件名为ComponentName的标签名改为DM.Cdstmp数据集中的CNAME字符 TLabel(FindComponent(ComponentName)).Caption := DM.Cdstmp.FieldByName('CNAME').AsString; //将组件名为ComponentName的标签颜色改为红色 TLabel(FindComponent(ComponentName)).Font.Color := clRed;