0

Is there any opportunity to copy objects behaviors to another?

e.g. I have an label "labelx" with the settings font size = 12 and color = blue Now I want to pass this settings to another label "y".

Thanks in advance!

1 Answers1

0
label2.font = label1.font;
label2.textColor = label1.textColor;

If you have a lot of this labels it would make sense to add them to an array and "copy" the properties in an enumerated loop.

You might want to take a look at this answer - it shows a way of deep-copying a label.

Community
  • 1
  • 1
Rok Jarc
  • 18,765
  • 9
  • 69
  • 124