我程序中用了10个checkbox控件,名字checkbox1、checkbox2...
我想得到如下结果,当选中某个checkbox1时,显示出该checkbox名字后面的数字,即选中checkbox1和checkbox2显示为1,2。我用了逐个遍历的方法。
if checkbox1.checked then
label1.caption:=label1.caption+'1';
if checkbox2.checked then
label1.caption:=label1.caption+'2';
........
请问有没有简单的方法?
我想得到如下结果,当选中某个checkbox1时,显示出该checkbox名字后面的数字,即选中checkbox1和checkbox2显示为1,2。我用了逐个遍历的方法。
if checkbox1.checked then
label1.caption:=label1.caption+'1';
if checkbox2.checked then
label1.caption:=label1.caption+'2';
........
请问有没有简单的方法?
with findcomponent('checkbox'+inttostr(i)) as Tcheckbox do
begin
if checked then
with findcomponent('label'+inttostr(i)) as Tlabel do
caption := caption + inttostr(i);
end;
要在动态创建的combobox中使用~就好了~