如何成组修改Lable组件的Caption属性(100分)

  • 主题发起人 主题发起人 Wangrunyuan
  • 开始时间 开始时间
W

Wangrunyuan

Unregistered / Unconfirmed
GUEST, unregistred user!
如何根据数据库中的字段值给成组的Lable组件进行Caption属性的付值
Lable1......Lable40
数据库表中值1.......40;但有时会可变
 
for i:=0 to ComponentCount-1 do
if uppercase(Components.ClassName)=UpperCase('Tlable') then
// 你的赋值语句;
 
先定义好每个label 的tag
for i:=0 to componentcount-1 do
begin
if tcomponent is tlabel then
if (tcomponent as tlabel).tag=fieldbyname('').asinteger then
(tcomponent as tlabel).caption
end;
 
for I := Form1.ComponentCount - 1 downto 0 do
begin
if Component.ClassName='TLabel' then begin
//query your label caption
//set label caption;
end;
end;
 
发迟了!!!懊恼!
 

findcomponent(LableName)可以根据名字来找到部件
具体操作可以按照此来
 

Similar threads

后退
顶部