tlabel

how to copy all the TLabels parented with a TPanel on delphi to another TPanel?

喜欢而已 提交于 2019-12-02 20:02:49
问题 I have a TPanel on a delphi form, I want to copy all the TLabels parented with this TPanel when i press a button and put them in other panel. Is there a way to do that? Thanks. 回答1: To copy the TLabel controls from one TPanel to another you can use something like this Procedure CopyLabels(ParentControl,DestControl:TWinControl); var i : integer; ALabel : TLabel; begin for i := 0 to ParentControl.ControlCount - 1 do if ParentControl.Controls[i] is TLabel then begin ALabel:=TLabel.Create

how to copy all the TLabels parented with a TPanel on delphi to another TPanel?

左心房为你撑大大i 提交于 2019-12-02 08:45:55
I have a TPanel on a delphi form, I want to copy all the TLabels parented with this TPanel when i press a button and put them in other panel. Is there a way to do that? Thanks. To copy the TLabel controls from one TPanel to another you can use something like this Procedure CopyLabels(ParentControl,DestControl:TWinControl); var i : integer; ALabel : TLabel; begin for i := 0 to ParentControl.ControlCount - 1 do if ParentControl.Controls[i] is TLabel then begin ALabel:=TLabel.Create(DestControl); ALabel.Parent :=DestControl; ALabel.Left :=ParentControl.Controls[i].Left; ALabel.Top :=ParentControl