1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32:
| private MyLabels : Array[0..4] of TLabel;
const MyProps: array[0..9] of record Index: Integer; PropName: String; PropValue: Integer; end = ( (Index: 0; PropName: 'Top'; PropValue: 10), (Index: 1; PropName: 'Top'; PropValue: 20), (Index: 2; PropName: 'Top'; PropValue: 30), (Index: 3; PropName: 'Top'; PropValue: 40), (Index: 4; PropName: 'Top'; PropValue: 50), (Index: 0; PropName: 'Left'; PropValue: 10), (Index: 1; PropName: 'Left'; PropValue: 20), (Index: 2; PropName: 'Left'; PropValue: 30), (Index: 3; PropName: 'Left'; PropValue: 40), (Index: 4; PropName: 'Left'; PropValue: 50) );
procedure TForm1.Button1Click(Sender: TObject); var i : integer; begin for i := 0 to 4 do begin MyLabels[i] := TLabel.Create(Form1); MyLabels[i].Parent := Form1; end; for i := Low(MyProps) to High(MyProps) do SetIntProperty(MyLabels[MyProps[i].Index], MyProps[i].PropName, MyProps[i].PropValue); end; |