将创建的Label放到一个动态数组(Array of TLabel)啊。下次创建时,对于已经有的Label,只需要更改它的Caption;已有的不够则创建;有多余则Free吊。———————————————————————————————————— 宠辱不惊,看庭前花开花落,去留无意;毁誉由人,望天上云卷云舒,聚散任风。 ————————————————————————————————————
//先Free all Labelfor i:=0 to ScrollBox1.Control1.Count-1 do if ScrollBox1.Control1[i] is TLabel then (ScrollBox1.Control1[i] as TLabel).Free;
有一条的话label1.visible := True; label1.visible:= false;
或者你用free了
宠辱不惊,看庭前花开花落,去留无意;毁誉由人,望天上云卷云舒,聚散任风。
————————————————————————————————————
if ScrollBox1.Control1[i] is TLabel then
(ScrollBox1.Control1[i] as TLabel).Free;
//再动态生成