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


I have a tapeline on Delphi form, I want to copy all the TLabels parented with a TPanel when I press a button And put them in the other panel. Is there any way to do this? Thank you.

to copy you can do TLabel controller with a TPanel Use something like this

  Process Copy Label (Parental Control, Lost Control: TWINControl); Var i: integer; AleBell: TLBL; Starting parentcontrol.ControlCount-1 with I: = 0, if ParentControl.Controls [i] is TLabel then start Abell: = TLabel.Create (DestControl); Alabel Parents: = DestControl; Alabel Lift: = Parent Control. Control [i]. leave; Elabel Refresh: = Parents Control [i]. Top; Alabel With: = parent control. Control [i]. With; Alabel Height: Parent Control. Control [i]. Heights; ALabel.Caption :. = TLabel (ParentControl.Controls [i]) Caption; // You can manually add more properties such as fonts or other ends; End;   

and use it like this

  copy label (panel1, panel2);   

You can also use the RTTI to copy the properties from each other, but as you do not specify your Delphi version only I I'll show simple examples.

Comments